Bug 999331: searching attachment data is very slow due to an unbounded
select r=LpSolit, a=glob git-svn-id: svn://10.0.0.236/trunk@265386 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
3f7ab81853
commit
4dbd6fb4a5
@ -1 +1 @@
|
|||||||
9020
|
9021
|
||||||
@ -1 +1 @@
|
|||||||
0e18b44ee2dc59bf5b0816fd2a26a90b81057384
|
b0df54c7f19387f72124b53431473374db26c0cf
|
||||||
@ -2053,6 +2053,13 @@ sub _quote_unless_numeric {
|
|||||||
|
|
||||||
sub build_subselect {
|
sub build_subselect {
|
||||||
my ($outer, $inner, $table, $cond, $negate) = @_;
|
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
|
# Execute subselects immediately to avoid dependent subqueries, which are
|
||||||
# large performance hits on MySql
|
# large performance hits on MySql
|
||||||
my $q = "SELECT DISTINCT $inner FROM $table WHERE $cond";
|
my $q = "SELECT DISTINCT $inner FROM $table WHERE $cond";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user