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

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

Commit message

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

Description of the change

The index that was created in https://code.launchpad.net/~stevenk/launchpad/buildfarmjob-index/+merge/123675 does solve the main case of Builder:+history, and makes the page performant. The page also allows the user to filter by status, and the query to filter by BuildFarmJob.status results in a table scan. Let's add another index that looks like the existing one but adds status into the mix.

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 both qastaging and 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-4.sql'
2--- database/schema/patch-2209-27-4.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-27-4.sql 2012-09-11 22:47:21 +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__status__date_finished__id__idx ON BuildFarmJob(builder, status, date_finished DESC, id) WHERE builder IS NOT NULL;
11+
12+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 27, 4);