summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-02-28 09:19:26 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-02-28 09:19:26 +0100
commitf0e69404788bc0ac89b21423bb22f464bc78fe0a (patch)
tree1ea18c632b60f9128eb02116f6bce85c3577292a /Bugzilla
parenta526c1f92b6818a8960280791abea805d8c79595 (diff)
downloadbugzilla-f0e69404788bc0ac89b21423bb22f464bc78fe0a.tar.gz
bugzilla-f0e69404788bc0ac89b21423bb22f464bc78fe0a.tar.xz
Bug 731055: get_enterable_products() is very slow when a product has many components or versions
r/a=mkanat
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 93142b3b7..bda055af4 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1036,12 +1036,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} =