Merge lp:~gmb/launchpad/bug-615644 into lp:launchpad/db-devel

Proposed by Graham Binns
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 9646
Proposed branch: lp:~gmb/launchpad/bug-615644
Merge into: lp:launchpad/db-devel
Diff against target: 41 lines (+8/-12)
1 file modified
lib/lp/bugs/model/bugtarget.py (+8/-12)
To merge this branch: bzr merge lp:~gmb/launchpad/bug-615644
Reviewer Review Type Date Requested Status
Julian Edwards (community) release-critical Approve
Robert Collins (community) Approve
Launchpad code reviewers code Pending
Review via email: mp+32175@code.launchpad.net

Commit message

The queries for calculating the max bug heat for a target have been altered to improve efficiency.

Description of the change

This branch fixes bug 615644 by changing the queries used to get the maximum heat for a target (see the bug for Stub's description of the fix).

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Looks great to me.

review: Approve
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Good job, thanks.

review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/model/bugtarget.py'
2--- lib/lp/bugs/model/bugtarget.py 2010-06-25 18:48:13 +0000
3+++ lib/lp/bugs/model/bugtarget.py 2010-08-10 09:14:01 +0000
4@@ -251,29 +251,25 @@
5 return
6
7 if IDistribution.providedBy(self):
8- sql = ["""SELECT Bug.heat
9+ sql = ["""SELECT MAX(Bug.heat)
10 FROM Bug, Bugtask
11 WHERE Bugtask.bug = Bug.id
12- AND Bugtask.distribution = %s
13- ORDER BY Bug.heat DESC LIMIT 1""" % sqlvalues(self),
14- """SELECT Bug.heat
15+ AND Bugtask.distribution = %s""" % sqlvalues(self),
16+ """SELECT MAX(Bug.heat)
17 FROM Bug, Bugtask, DistroSeries
18 WHERE Bugtask.bug = Bug.id
19 AND Bugtask.distroseries = DistroSeries.id
20- AND DistroSeries.distribution = %s
21- ORDER BY Bug.heat DESC LIMIT 1""" % sqlvalues(self)]
22+ AND DistroSeries.distribution = %s""" % sqlvalues(self)]
23 elif IProduct.providedBy(self):
24- sql = ["""SELECT Bug.heat
25+ sql = ["""SELECT MAX(Bug.heat)
26 FROM Bug, Bugtask
27 WHERE Bugtask.bug = Bug.id
28- AND Bugtask.product = %s
29- ORDER BY Bug.heat DESC LIMIT 1""" % sqlvalues(self),
30- """SELECT Bug.heat
31+ AND Bugtask.product = %s""" % sqlvalues(self),
32+ """SELECT MAX(Bug.heat)
33 FROM Bug, Bugtask, ProductSeries
34 WHERE Bugtask.bug = Bug.id
35 AND Bugtask.productseries = ProductSeries.id
36- AND ProductSeries.product = %s
37- ORDER BY Bug.heat DESC LIMIT 1""" % sqlvalues(self)]
38+ AND ProductSeries.product = %s""" % sqlvalues(self)]
39 elif IProjectGroup.providedBy(self):
40 sql = ["""SELECT MAX(heat)
41 FROM Bug, Bugtask, Product

Subscribers

People subscribed via source and target branches

to status/vote changes: