Closed (fixed)
Project:
Simplenews
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2008 at 15:12 UTC
Updated:
25 Jun 2008 at 09:15 UTC
Jump to comment: Most recent file
On our site we have a number of subscriptions which are verified by uid - however, because the uid column is not indexed in simplenews_subscriptions, it was acting slow - the site became very fast after adding the index. The code for an update is:
/**
* Addition of uid to simplenews_subscriptions
*/
function simplenews_update_6003() {
$ret = array();
db_add_index($ret, 'simplenews_subscriptions', 'uid', array('uid'));
return $ret;
}
while the schema gets a new array entry:
'uid' => array('uid'),
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | simplenews.268965.patch | 1.13 KB | sutharsan |
| #2 | simplenews_6x_btmash_0001.patch | 875 bytes | btmash |
Comments
Comment #1
sutharsan commentedCan you explain to me where simplenews requires an index on uid in the simplenews_subscriptions table.
Comment #2
btmash commentedI'm attaching the patch (its a patch from subversion though converting to cvs patch should be simple at this stage) so you can see the exact changes and where they go.
Comment #3
sutharsan commentedAn upgrade is also required on the schema.
But WHY. Please explain where simplenews requires an index on uid in the simplenews_subscriptions table. What is the problem we are fixing here?
Comment #4
btmash commentedIf you look at the patch, you'll see the line
'uid' => array('uid'). That is in the schema (look at the line number).As for "WHY". On the various joins between the users table and the simplenews_subscriptions table (found in simplenews_send_node, simplenews_get_subscription) - on the queries done strictly against the uid (also in simplenews_get_subscription and a bunch of other places...most of them in the same place as where queries to check against the mail are)
The same case could be made against having an index for mail. Why is that there then?
Comment #5
sutharsan commentedThanks for the explanation.
Comment simplenews_update_6003() changed.
Patch committed.
Comment #6
sutharsan commentedComment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.