Does not scale well with many comments
| Project: | jRating |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | by design |
Jump to:
Hi, I'm not sure how/where to file this, because I don't think it's really a bug in your implementation, but more of an issue with how Drupal handles its modules. Anyway...
I recently deployed jRating in the forums of a site I run so that users could rate each others' comments. Unfortunately, I learned the hard way that there are a few separate database queries made for each comment on a given forum post. As an example, I had one forum post with several dozen comments, and when I turned on voting for each comment, the number of queries on that page went from 966 to 1757(!). Obviously, this really hurt the time it took to load that page.
I think that from an efficiency standpoint, the best way to keep all those queries from happening would be to get all of the comment IDs up front, and then issue a single SQL query against the votingapi_vote table where the content_id was in one of a comma delimited list of IDs. i.e.: WHERE content_id IN (1, 2, 3, ...).
Anyway, sorry if this isn't the right place to report this, but I figured I should bring it up somewhere. If you know of a better place I should bring this up, please let me know.
Thanks,
-- Doug

#1
I think this is a pretty standard problem with the way Drupal's modular system works, unfortunately - lots of individual database calls. I don't think there's a better way of doing this at present (though you might be able to use memcache to reduce the number of hits to the database). You might want to try posting this in the main discussion forums, as you are starting to get to be a very large number of database calls for each page.
I'm closing this for now, as I don't think jRating can do anything about it.