Merge lp:~stevenk/launchpad/buildfarmjob-index into lp:launchpad

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

Commit message

Add a new partial index on BuildFarmJob(builder, date_finished, id).

Description of the change

As one half of the fix for the linked bug, add an index onto BuildFarmJob. This will be used by https://code.launchpad.net/~stevenk/launchpad/builder-history-better-query/+merge/123676 to speed up the query used by Builder:+history from approximately 9 seconds to 2ms.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) :
review: Approve (db)
Revision history for this message
Stuart Bishop (stub) wrote :

Applied to qastaging

Revision history for this message
Stuart Bishop (stub) wrote :

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-27-3.sql'
2--- database/schema/patch-2209-27-3.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-27-3.sql 2012-09-11 06:19:20 +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 buildfarmjob__builder__date_finished__id__idx ON BuildFarmJob(builder, date_finished DESC, id) WHERE builder IS NOT NULL;
11+
12+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 27, 3);