Merge lp:~wgrant/launchpad/more-indices into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 14844
Proposed branch: lp:~wgrant/launchpad/more-indices
Merge into: lp:launchpad
Diff against target: 14 lines (+10/-0)
1 file modified
database/schema/patch-2209-00-9.sql (+10/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/more-indices
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Robert Collins db Pending
Review via email: mp+93916@code.launchpad.net

Commit message

Add a couple more indices to satisfy script-monitor and branch->bug queries.

Description of the change

Add a couple more indices to satisfy script-monitor and branch->bug queries.

Filtering BugBranch on branch is currently sometimes done with the (bug, branch) index, but it's obviously slow. Sometimes it chooses a seq scan instead.

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

Looks good.

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

Applied live.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-00-9.sql'
2--- database/schema/patch-2209-00-9.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-00-9.sql 2012-02-21 04:15:24 +0000
4@@ -0,0 +1,10 @@
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 bugbranch__branch__idx ON bugbranch USING btree (branch);
11+CREATE INDEX scriptactivity__hostname__name__date_completed__idx
12+ ON scriptactivity USING btree (hostname, name, date_completed);
13+
14+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 0, 9);