My site is going to be calculating vote cache incrementally - that is, rather than pulling all current votes (we're hoping for millions per node) we will instead pull the current cache values and add/remove counts and averages as needed on the fly. This means we want to suppress votingapi_votingapi_storage_standard_results() from querying for all of those records.
Currently, this function uses db_query, so there is no method that I'm aware of to prevent it from pulling all of the data; it will simply run.
The attached patch is my solution for switching over to db_select(). I added tags -"votingapi" and "standard_results" on both queries, and then "points", "percent" and "option" on their related queries. This allows me to grab exactly the query/ies I need to override.
This is my first patch submission, so please let me know if something is amiss or I need to re-categorize the issue. I did read the docs and tried my best to follow the guidelines!
| Comment | File | Size | Author |
|---|---|---|---|
| votingapi_recalculate_alterable.patch | 2.6 KB | succinct |
Comments
Comment #1
succinct commentedHere is my implementation of the hook, by the way:
Comment #2
pifagor