Closed
Bug 179697
Opened 22 years ago
Closed 22 years ago
OR terms need extra level of bracketing
Categories
(Bugzilla :: Query/Bug List, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.18
People
(Reporter: bbaetz, Assigned: bbaetz)
References
()
Details
Attachments
(2 files)
565 bytes,
patch
|
myk
:
review+
|
Details | Diff | Splinter Review |
7.90 KB,
text/plain
|
Details |
The url here does 'short_desc' 'allwordssubstr' 'foo bar' OR 'status_whiteboard' 'allwordssubstr' 'foo bar' This becomes (INSTR(LOWER(bugs.short_desc), 'foo') AND INSTR(LOWER(bugs.short_desc), 'bar') OR INSTR(LOWER(bugs.status_whiteboard), 'foo') AND INSTR(LOWER(bugs.status_whiteboard), 'bar')) instead, it should be: ((INSTR(LOWER(bugs.short_desc), 'foo') AND INSTR(LOWER(bugs.short_desc), 'bar')) OR (INSTR(LOWER(bugs.status_whiteboard), 'foo') AND INSTR(LOWER(bugs.status_whiteboard), 'bar'))) Note the extra bracketing. Without this, the query is read left to right, and is asking for all bugs where: short_desc contains 'foo' AND (short_desc contains 'bar' OR (whiteboard contains foo AND whiteboard contains bar))) which isn't optimisiable easily, and so this then becomes basically a full db search. The bugzilla sidebar generates queries like this - see bug 179500. The fix is to change if (@orlist) { push(@andlist, "(" . join(" OR ", @orlist) . ")"); } in Bugzilla::Search to do the @orlist join by bracketing each term first before doing the bracketing for pusshin to @andlist. To make the queries simpler/easier to read, we may want to only add the extra bracketing if scalar(@orlist) > 1.
Assignee | ||
Comment 1•22 years ago
|
||
I don't think that this should break any valid query (famous last words, I know...)
Assignee | ||
Comment 2•22 years ago
|
||
-> me
Assignee: endico → bbaetz
Target Milestone: --- → Bugzilla 2.18
Assignee | ||
Updated•22 years ago
|
Attachment #106027 -
Flags: review?(myk)
Comment 3•22 years ago
|
||
The patch certainly *seems* right, but it doesn't have any measurable impact. Here are explains from the query in the URL as well as from a "foo bar" search with the Mozilla search sidebar. In both cases the explains are the same before and after the patch, and the queries take exactly the same time to run.
Comment 4•22 years ago
|
||
Comment on attachment 106027 [details] [diff] [review] fix this seems sensible nonetheless. r=myk
Attachment #106027 -
Flags: review?(myk) → review+
Comment 5•22 years ago
|
||
a= justdave
Assignee | ||
Comment 6•22 years ago
|
||
Fixed. The lack of a difference between queries is because mysql doesn't optimise OR stuff.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
QA Contact: matty_is_a_geek → default-qa
You need to log in
before you can comment on or make changes to this bug.
Description
•