Hi,
I've noticed that if there are a LOT of users on the site and a number of calls are made to get the current points of a user, it can get very slow. On closer inspection, I saw that there was no index created on the uid, tid pair in the userpoints table.
So an update would be (I can provide in patch format if that is preferred):
// To sigify that this is a drupal 6 update
function userpoints_update_6009() {
$ret = array();
db_add_index($ret, 'userpoints', 'uid_tid', array('uid', 'tid'));
return $ret;
}
I'm not sure if a similar index in needed in userpoints_txn yet but I noticed a significant speed bump upon doing this change.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | userpoints_5_3x_btmash_0001.patch | 1.2 KB | btmash |
| #3 | userpoints_drupal6_btmash_0001.patch | 909 bytes | btmash |
Comments
Comment #1
kbahey commentedGood idea.
Can you roll a patch?
Also, you need to add this to the schema itself, so new installations would get it too.
As a bonus, a patch for 5.x-3.x-dev would be appreciated too ...
Comment #2
btmash commentedI'm attaching the patch for the 6.x version first (since I don't currently have 5.x on my local machine) - I'll look into the 5.x version as soon as I get some more time.
Comment #3
btmash commentedAck...I completely forgot to add the patch.
Comment #4
kbahey commentedThanks.
Committed to 6.x-1.x-dev.
Comment #5
btmash commentedHere is the patch for the 5.x version - please check and see that the patch makes sense (I did a diff with 5.3.x-dev).
Comment #6
btmash commentedShould have changed status...
Comment #7
kbahey commentedCommitted to 5.x-3.x-dev.
Thanks!
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.