Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
user.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Oct 2009 at 14:15 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
moshe weitzman commentedThis is pretty awful. See below.
And the explain
Comment #2
JeremyFrench commentedWhen there are no filters the join in this query is not used but takes a lot of time to execute, it also necessitates the distinct clause. All that is really needed in these cases is:
SELECT u.uid, u.name, u.status, u.created, u.access FROM users u WHERE u.uid != 0 ORDER BY u.created DESC LIMIT 0, 50Running these queries locally (with about 1M users) in mysql results in the execute time reducing from 60s to 0.01s
A patch is applied which examines the filters returned from user_build_filter_query() to decide whether to put the join in the query or not.
Comment #3
JeremyFrench commentedComment #4
JeremyFrench commentedComment #5
JeremyFrench commentedComment #6
moshe weitzman commentedNice solution.
Comment #7
gábor hojtsyBugs are first fixed in the latest Drupal version, in this case Drupal 7 and then backported. Otherwise, this same issue will come back in Drupal 7, and we need to attack it again. Thanks!
Comment #8
moshe weitzman commentedComment #9
JeremyFrench commentedI'm working on a patch, However I think that http://drupal.org/node/604304 is the D7 version of this bug?
Comment #10
JeremyFrench commentedThe D7 version of this bug is now fixed. See http://drupal.org/node/604304, should the reviewed D6 patch above be put into that ticket, or can we set this ticket as D6?
Comment #11
moshe weitzman commentedLets try to just work here. Back to RTBC
Comment #12
bjcool commentedsubscribe
Comment #13
gábor hojtsyLooks like a good patch, helps us avoid some joins in the initial state. The D7 patch also looses the DISTINCT saying that we can only choose one role, so we'll not get duplicates. That is true here as well, is it?
Comment #14
JeremyFrench commentedNot quite. The D7 patch is a little more sophisticated. With that there is a join for each filter, so there is no need for a DISTINCT. However the way that the query is built up in D6 makes this impractical. So for D6 we still need the distinct.
Comment #15
moshe weitzman commentedback to rtbc
Comment #16
gábor hojtsyOk, thank you. Committed to Drupal 6.