Closed Bug 731055 Opened 13 years ago Closed 13 years ago

get_enterable_products() is very slow when a product has many components or versions

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

I created one product with 1000 components, which is not so uncommon (think RedHat, who probably has several hundreds of components for some products), and now $user->get_enterable_products() is terribly slow, around 3 seconds on my machine. This method is used by $bug->choices to determine which products to list in the product field in show_bug.cgi, making each bug very slow to load in the web browser. The culprit is this query: $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');
Flags: blocking4.2.1+
Attached patch patch, v1 (obsolete) (deleted) — Splinter Review
It now takes 0.03 second instead of 3 seconds. 100 times faster. :)
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #601129 - Flags: review?(mkanat)
Comment on attachment 601129 [details] [diff] [review] patch, v1 Review of attachment 601129 [details] [diff] [review]: ----------------------------------------------------------------- ::: Bugzilla/User.pm @@ +1036,5 @@ > # 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 > + WHERE products.id IN (' . join(',', @$enterable_ids) . ') You have to use sql_in here, or Oracle will break.
Attachment #601129 - Flags: review?(mkanat) → review-
Attached patch patch, v1.1 (deleted) — Splinter Review
Attachment #601129 - Attachment is obsolete: true
Attachment #601132 - Flags: review?(mkanat)
FYI, with this patch, it now takes 4 seconds to load a bug report on my machine instead of 7 seconds. :)
Attachment #601132 - Flags: review?(mkanat) → review?(glob)
Attachment #601132 - Flags: review?(glob) → review+
Flags: approval4.2+
Flags: approval+
mkanat: do you think that such a perf win could justify a backport to 4.0 despite this branch is now restricted to security fixes only since last week? It's a major performance win, and not just a theoretical edge case. We are talking about several seconds here. But I'm fine with a "no, it's too late" too. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/User.pm Committed revision 8135. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/ modified Bugzilla/User.pm Committed revision 8040.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Summary: get_enterable_products() is very slow when a product has many components → get_enterable_products() is very slow when a product has many components or versions
(In reply to Frédéric Buclin from comment #0) > I created one product with 1000 components, which is not so uncommon (think > RedHat, who probably has several hundreds of components for some products), When I left Red Hat over a year ago, Fedora product had 6000+ components and each of the RHEL products had 3000+ so not uncommon. dkl
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: