For now just a way to store some performance related things I found out. I'll implement them at a later point when the features are in. Probably after 1.0
1) We need a key on thread_id, uid in the pm_index table to be able to query the participants of a thread faster.
2) "SELECT DISTINCT pm.author, u.name FROM pm_message pm INNER JOIN pm_index pmi ON pm.mid = pmi.mid INNER JOIN users u ON pm.author = u.uid WHERE pmi.uid = 1 AND u.uid > 0 ORDER BY u.name". That query is *SLOW*. And changing it to participants might make it even worse, the best I could get with querying all participants of threads where I'm a participant too is the following: "SELECT u.uid, u.name FROM pm_index pmi INNER JOIN pm_index pmir ON pmir.mid = pmi.mid INNER JOIN users u ON pmir.uid = u.uid WHERE pmi.uid = 1 AND pmi.mid = pmi.thread_id group by pmir.uid ORDER BY u.name", which means a pm_index -> pm_index join on all first messages of each thread. The best thing is probably to use a cache on that information or even better, replace it with a autocomplete.
3) The list query is also pretty slow, but most of the time (~3/4) is used for sorting because we sort on a MAX(timestamp) field. Pretty hard to optimize that and we need the sort.
Note: My (generated) data is most probably not typical, because I have many messages (~35k) on only a few users (~50), this means that for example uid 1 is listed as participant in ~7k messages. If there are <100 messages per user, it should be way faster as most queries use uid indexes.
Comments
Comment #1
berdir- Create a fake user object with only uid and name for theme('username', $account) instead of calling user_load for all users.
Comment #2
oadaeh commentedThis issue is being closed because it is against a branch for a version of Drupal that is no longer supported.
If you feel that this issue is still valid, feel free to re-open and update it (and any possible patch) to work with the 7.x-1.x branch (bug fixes only) or the 7.x-2.x branch.
Thank you.