SELECT DISTINCT(n.nid) FROM node n INNER JOIN project_issues p ON p.nid = n.nid INNER JOIN node_revisions r ON r.vid = n.vid INNER JOIN users u ON p.assigned = u.uid LEFT JOIN project_comments c ON c.nid = p.nid WHERE n.status = 1
This query does not use an index on the project_issues table.
After doing
alter table project_issues add index (nid,assigned);
the new index is used.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | pi.nid_assigned.patch_2.txt | 1.91 KB | dww |
| #3 | pi.nid_assigned.patch | 1.84 KB | hunmonk |
Comments
Comment #1
gerhard killesreiter commentedNot sure what has been changed inthe meantime but the new index is not used.
Comment #2
gerhard killesreiter commentedI am confused
alter table project_issues add index nid_assigned (nid,assigned);
The explain says:
Comment #3
hunmonk commentedattached patch adds the described index. untested.
Comment #4
hunmonk commentedworks for updates and fresh install on postgres.
Comment #5
dwwtypos causing SQL errors in the update on mysql. new patch works fine on mysql upgrade and install. since i didn't touch the pgsql cases, I'm calling this RTBC. ;)
Comment #6
hunmonk commentedcomitted to HEAD, 4.7.x-1.x, 4.7.x-2.x
Comment #7
(not verified) commented