Right now thanks to #15380: Allow to configure content of issue notification e-mails whenever a user creates an issue we do a separate query against {project_issue_notification_global} to find email preferences for every user subscribed to all issues in that project's queue (and the author of the node if they're subscribed at least to own issues).
When someone comments, not only do we do each of those queries again, we also do a separate query for each user following the issue.
We already do a couple of queries to find all these users in advance. We could use that to do a single query to load all of their email preferences in one query with a big uid IN ()
. It'd slightly complicate the code (and we'd need to expand the API to handle a load-multiple approach). But in speaking to killes and nnewton, they would be happier if we did this (although they agreed it wasn't a deployment blocker per se). This should be relatively easy if anyone wants to work on a patch. Please assign this issue to yourself if you start working on the code so no one duplicates the effort. For now, use the end of the '34496-flag-integration' branch.
Thanks,
-Derek
Comment | File | Size | Author |
---|---|---|---|
#3 | 1304594-3.consolidate-preference-queries.patch | 3.71 KB | dww |
Comments
Comment #1
dwwAdding tags, including a new "drupal.org performance" tag that seems like it would be useful for tracking issues related to improving performance on d.o in some way...
Comment #2
dwwI'm working on a patch now. Stay tuned.
Comment #3
dwwUntested, but I think this will work.
Comment #4
dwwFYI: tested on the dev site and it appears to work (at least for the N=2 case, which is probably good enough). ;)
Anyone want to do a code review before I commit/push?
Thanks,
-Derek
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedPatch looks sane to me.
Comment #6
dwwThanks for the review, Moshe!
Committed and pushed:
http://drupal.org/commitlog/commit/1894/5ed0460c9ab22d47cf080d4e61ebdfb8...