Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder Apothem's Avatar
    Join Date
    Mar 2008
    Thanked 25 Times in 25 Posts

    Efficient ways to make Rating scripts?

    So this has been bobbled up in my head for quite some time: What other ways are there to create an efficient rating script?

    So here are the only ways I've thought of, visavi MySQL:
    1) Constantly summing the ratings and dividing it by the total amount of ratings available in a table. This is, in my opinion, the slowest way to do things.
    2) Have two fields in a table called ratingSum and totalRaters, where you can just do ratingSum/totalRaters. This is the faster way, but I think that it isn't as "nice"

    What would be more efficient than #2?

  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,170 Times in 1,161 Posts
    It depends on what you're rating.

    I think #2 is the best way for something like books, or videos ...
    Say you have a database full of books. Each row is one book.
    If people were rating the books, it would be easiest to add the user's
    rating to one field (sum), and then increment another field (qty - how many votes).

    Now if you're comparing ratings between a whole table of items, instead of
    rating each item separately, that might change things.

    So, I guess you would have to analyze each situation differently, and you didn't
    specify exacty what you're rating ... so I guess we'll never know.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts