Merge lp:~julian-edwards/launchpad/slow-ppa-search-bug-659129 into lp:launchpad/db-devel

Proposed by Julian Edwards
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 9890
Proposed branch: lp:~julian-edwards/launchpad/slow-ppa-search-bug-659129
Merge into: lp:launchpad/db-devel
Diff against target: 11 lines (+1/-1)
1 file modified
lib/lp/registry/model/distribution.py (+1/-1)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/slow-ppa-search-bug-659129
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Graham Binns (community) code Approve
Robert Collins (community) release-critical Approve
Review via email: mp+38307@code.launchpad.net

Commit message

Prevent the /ubuntu/+ppas page from timing out by fixing a slow query that PG8.4 hates.

Description of the change

See the bug, but in a nutshell:

Removes the DISTINCT clause from the slow query as per stub's suggestion in the bug.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) :
review: Approve (release-critical)
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Since it's not updating the diff with the new changes, here it is:

1=== modified file 'lib/lp/registry/model/distribution.py'
2--- lib/lp/registry/model/distribution.py 2010-10-13 09:17:14 +0000
3+++ lib/lp/registry/model/distribution.py 2010-10-14 10:16:50 +0000
4@@ -1442,12 +1442,11 @@
5 clauses = ["""
6 Archive.purpose = %s AND
7 Archive.distribution = %s AND
8- Person.id = Archive.owner AND
9- Person.id = ValidPersonOrTeamCache.id
10+ Archive.owner = ValidPersonOrTeamCache.id
11 """ % sqlvalues(ArchivePurpose.PPA, self)]
12
13- clauseTables = ['Person', 'ValidPersonOrTeamCache']
14- orderBy = ['Person.name']
15+ clauseTables = ['ValidPersonOrTeamCache']
16+ orderBy = ['Archive.displayname']
17
18 if not show_inactive:
19 active_statuses = (PackagePublishingStatus.PUBLISHED,
20
21=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppas.txt'
22--- lib/lp/soyuz/stories/ppa/xx-private-ppas.txt 2010-02-24 15:59:22 +0000
23+++ lib/lp/soyuz/stories/ppa/xx-private-ppas.txt 2010-10-14 10:28:00 +0000
24@@ -49,10 +49,10 @@
25 >>> cprov_browser.getControl(name="show_inactive").value = True
26 >>> cprov_browser.getControl('Search', index=0).click()
27 >>> list_ppas_in_browser_page(cprov_browser)
28+ PPA for Celso Providelo...
29+ PPA for Mark Shuttleworth...
30+ PPA for No Privileges Person...
31 PPA named p3a for Celso Providelo...
32- PPA for Celso Providelo...
33- PPA for Mark Shuttleworth...
34- PPA for No Privileges Person...
35
36 Let's make a new team PPA for "landscape-developers" and make it
37 private.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/model/distribution.py'
2--- lib/lp/registry/model/distribution.py 2010-10-04 20:46:55 +0000
3+++ lib/lp/registry/model/distribution.py 2010-10-13 09:28:58 +0000
4@@ -1454,7 +1454,7 @@
5 PackagePublishingStatus.PENDING)
6 clauses.append("""
7 Archive.id IN (
8- SELECT DISTINCT archive FROM SourcepackagePublishingHistory
9+ SELECT archive FROM SourcepackagePublishingHistory
10 WHERE status IN %s)
11 """ % sqlvalues(active_statuses))
12

Subscribers

People subscribed via source and target branches

to status/vote changes: