summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-05-05 09:15:18 +0200
committerByron Jones <glob@mozilla.com>2014-05-05 09:15:18 +0200
commitb0df54c7f19387f72124b53431473374db26c0cf (patch)
tree2ad9ee5f1f44e142303abb1881c2e65dbd0ade71 /Bugzilla
parent0e18b44ee2dc59bf5b0816fd2a26a90b81057384 (diff)
downloadbugzilla-b0df54c7f19387f72124b53431473374db26c0cf.tar.gz
bugzilla-b0df54c7f19387f72124b53431473374db26c0cf.tar.xz
Bug 999331: searching attachment data is very slow due to an unbounded
select r=LpSolit, a=glob
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 1c008bdfb..75a0fbdb4 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -2053,6 +2053,13 @@ sub _quote_unless_numeric {
sub build_subselect {
my ($outer, $inner, $table, $cond, $negate) = @_;
+ if ($table =~ /\battach_data\b/) {
+ # It takes a long time to scan the whole attach_data table
+ # unconditionally, so we return the subselect and let the DB optimizer
+ # restrict the search based on other search criteria.
+ my $not = $negate ? "NOT" : "";
+ return "$outer $not IN (SELECT DISTINCT $inner FROM $table WHERE $cond)";
+ }
# Execute subselects immediately to avoid dependent subqueries, which are
# large performance hits on MySql
my $q = "SELECT DISTINCT $inner FROM $table WHERE $cond";