diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2012-02-28 09:22:03 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2012-02-28 09:22:03 +0100 |
commit | 8c6f924b7872555617f861aad1e1184ce6e09dad (patch) | |
tree | c84b94da196ad2f14c9e61d70ebc1b42252ac8d5 | |
parent | 4de13f571f0119c313a223474c1e64d7bdf6146f (diff) | |
download | bugzilla-8c6f924b7872555617f861aad1e1184ce6e09dad.tar.gz bugzilla-8c6f924b7872555617f861aad1e1184ce6e09dad.tar.xz |
Bug 731055: get_enterable_products() is very slow when a product has many components or versions
r/a=mkanat
-rw-r--r-- | Bugzilla/User.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 008322b17..391e416af 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -1040,12 +1040,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} = |