Closed
Bug 365179
Opened 18 years ago
Closed 18 years ago
Performance problems with multiple fields chosen in the "where one or more of the following changed" box
Categories
(Bugzilla :: Query/Bug List, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 3.0
People
(Reporter: justdave, Assigned: LpSolit)
References
Details
(Keywords: perf)
Attachments
(3 files, 1 obsolete file)
Our SQL when multiple fields are selected in the "where one or more of the following changed:" box is bad, and is causing severe performance problems on b.m.o.
Reporter | ||
Comment 1•18 years ago
|
||
Assignee | ||
Comment 2•18 years ago
|
||
joel, any clue? The problem comes from Search.pm around line 354:
push(@supptables, "LEFT JOIN bugs_activity AS actcheck " .
"ON (" . join(" OR ", @actlist) . "$extra )");
Reporter | ||
Comment 3•18 years ago
|
||
We should use IN() on the list of fieldids instead of a big block of ORs. MySQL does a binary search on the contents of an IN() which is a lot faster than comparing a bunch of ORs.
Also, the way this is written currently makes me thing that only the last field in the list is actually going to work, because I think AND has precedence over OR, and there's an AND adjacent to the last fieldid.
Assignee | ||
Comment 4•18 years ago
|
||
I haven't tested this patch *at all* and I have no idea if it's correct or not, nor whether it fixes the perf issue. So it really needs to be tested.
Attachment #249809 -
Flags: review?(justdave)
Reporter | ||
Comment 5•18 years ago
|
||
Comment on attachment 249809 [details] [diff] [review]
untested patch, v0.1
This works, and works great. Still accurate, and cuts the time for running that specific query down to about 2 seconds (from over 40 minutes, that's a hell of an improvement).
>+ my $extra = " ON actcheck.bug_id = bugs.bug_id";
I'd prefer to cut the ON out of here ^^^
> push(@supptables, "LEFT JOIN bugs_activity AS actcheck " .
>- "ON (" . join(" OR ", @actlist) . "$extra )");
>+ "$extra AND actcheck.fieldid IN (" . join(",", @actlist) . ")");
and put it here ^^^ instead. Makes it a little more readable.
push(@supptables, "LEFT JOIN bugs_activity AS actcheck " .
"ON $extra AND actcheck.fieldid IN (" . join(",", @actlist) . ")");
Carry forward r+ with that change.
Attachment #249809 -
Flags: review?(justdave) → review+
Assignee | ||
Comment 6•18 years ago
|
||
Carrying forward justdave's r+
Assignee: query-and-buglist → LpSolit
Attachment #249809 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #249813 -
Flags: review+
Assignee | ||
Comment 7•18 years ago
|
||
Is 2.22 affected too?
Flags: blocking3.0?
Flags: approval?
Target Milestone: --- → Bugzilla 3.0
Assignee | ||
Comment 8•18 years ago
|
||
(In reply to comment #7)
> Is 2.22 affected too?
>
Hum, looking at bug 276232, it seems that 2.22 is not affected as it doesn't have this OR thing.
Reporter | ||
Comment 9•18 years ago
|
||
Comment on attachment 249813 [details] [diff] [review]
patch, v1
>+ my $extra = " actcheck.bug_id = bugs.bug_id";
nit: you don't need the space ^^^ at the beginning of the string here
>+ "ON $extra AND actcheck.fieldid IN (" .
because you have it here --------------^
Reporter | ||
Updated•18 years ago
|
Flags: blocking3.0?
Flags: blocking3.0+
Flags: approval?
Flags: approval+
Assignee | ||
Comment 10•18 years ago
|
||
Checking in Bugzilla/Search.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v <-- Search.pm
new revision: 1.144; previous revision: 1.143
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•