diff options
author | Byron Jones <glob@mozilla.com> | 2014-05-05 09:16:05 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-05-05 09:16:05 +0200 |
commit | 117e82408036b85d6c8caa2c6c4919d6285387f5 (patch) | |
tree | 5bd418a25e6f979c5ecf89b04af7e84d91722f5f /Bugzilla | |
parent | 01350d7f6d66796ac0f18d6ab3582cd60f2525c5 (diff) | |
download | bugzilla-117e82408036b85d6c8caa2c6c4919d6285387f5.tar.gz bugzilla-117e82408036b85d6c8caa2c6c4919d6285387f5.tar.xz |
Bug 999331: searching attachment data is very slow due to an unbounded select
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Search.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index e060de990..0665fbd96 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -2091,6 +2091,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"; |