summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-02-29 17:02:33 +0100
committerByron Jones <bjones@mozilla.com>2012-02-29 17:02:33 +0100
commit67e2055776d64e7f6b2f34bb3f317da8dc15fcb0 (patch)
tree2c557745ecb06157325ecb167687d4e53ae6bc14 /Bugzilla
parent9bb808cf5286e5db4890b7be10443bdeef92b9a2 (diff)
downloadbugzilla-67e2055776d64e7f6b2f34bb3f317da8dc15fcb0.tar.gz
bugzilla-67e2055776d64e7f6b2f34bb3f317da8dc15fcb0.tar.xz
bug 731165: speed up get_enterable_products
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/User.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 61ebdbab1..d6e343429 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1041,12 +1041,14 @@ sub get_enterable_products {
# And all of these products must have at least one component
# and one version.
$enterable_ids = $dbh->selectcol_arrayref(
- 'SELECT DISTINCT products.id FROM products
- INNER JOIN components ON components.product_id = products.id
- INNER JOIN versions ON versions.product_id = products.id
- WHERE products.id IN (' . join(',', @$enterable_ids) . ')
- AND components.isactive = 1
- AND versions.isactive = 1');
+ 'SELECT DISTINCT products.id FROM products
+ WHERE ' . $dbh->sql_in('products.id', $enterable_ids) .
+ ' AND products.id IN (SELECT DISTINCT components.product_id
+ FROM components
+ WHERE components.isactive = 1)
+ AND products.id IN (SELECT DISTINCT versions.product_id
+ FROM versions
+ WHERE versions.isactive = 1)');
}
$self->{enterable_products} =