Merge lp:~stevenk/launchpad/spph-packageupload-index-redux into lp:launchpad

Proposed by Steve Kowalik on 2012-06-05
Status: Merged
Approved by: Steve Kowalik on 2012-06-06
Approved revision: no longer in the source branch.
Merged at revision: 15367
Proposed branch: lp:~stevenk/launchpad/spph-packageupload-index-redux
Merge into: lp:launchpad
Diff against target: 12 lines (+8/-0)
1 file modified
database/schema/patch-2209-15-3.sql (+8/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/spph-packageupload-index-redux
Reviewer Review Type Date Requested Status
Stuart Bishop db 2012-06-05 Approve on 2012-06-06
Robert Collins db 2012-06-05 Pending
Review via email: mp+108852@code.launchpad.net

Commit Message

Add an index on SourcePackagePublishingHistory.id where packageupload is unset so an upcoming garbo job can find publications to work on quickly.

Description of the Change

Add an index on SourcePackagePublishingHistory.id when packageupload is unset so that the query contained in https://code.launchpad.net/~stevenk/launchpad/set-spph-packageupload/+merge/108513 makes use of this index to find SPPHs that need to be checked.

To post a comment you must log in.
Stuart Bishop (stub) wrote :

This looks fine.

Have we tested those queries anywhere yet with the new index? I haven't had much success getting this sort of index used in joins with PG 8.4, but we are on 9.1 now. We can test on staging before applying to production easily enough.

review: Approve (db)
Stuart Bishop (stub) wrote :

This has been applied to production.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-15-3.sql'
2--- database/schema/patch-2209-15-3.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-15-3.sql 2012-06-05 23:48:24 +0000
4@@ -0,0 +1,8 @@
5+-- Copyright 2012 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+CREATE INDEX sourcepackagepublishinghistory__packageupload__idx ON sourcepackagepublishinghistory USING btree (id) WHERE packageupload IS NULL;
11+
12+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 15, 3);