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

Proposed by William Grant on 2012-04-23
Status: Merged
Approved by: William Grant on 2012-04-23
Approved revision: no longer in the source branch.
Merged at revision: 15138
Proposed branch: lp:~wgrant/launchpad/bugtaskflat-more-indices
Merge into: lp:launchpad
Diff against target: 58 lines (+54/-0)
1 file modified
database/schema/patch-2209-16-1.sql (+54/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/bugtaskflat-more-indices
Reviewer Review Type Date Requested Status
Stuart Bishop db 2012-04-23 Approve on 2012-04-23
Robert Collins db 2012-04-23 Pending
Review via email: mp+103063@code.launchpad.net

Commit Message

Add more BugTaskFlat sort indices (all the usuals for contextless searches, plus Bug.id for each set)

Description of the Change

This branch adds two sets of new indices to BugTaskFlat.

The first set is for contextless bug searches. It's just the usual 5 sort keys without a prefix. This handles pages like <https://launchpad.net/bugs/+bugs>.

The second is the addition of a new sort key, Bug.id, to each existing set of sort indices. This handles the 'Number' sort in the new search UI.

These should be applied live.

To post a comment you must log in.
Stuart Bishop (stub) :
review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-16-1.sql'
2--- database/schema/patch-2209-16-1.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-16-1.sql 2012-04-23 09:23:22 +0000
4@@ -0,0 +1,54 @@
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+-- Add the usual 5 search indices for the global contextless bug listing.
11+CREATE INDEX bugtaskflat__date_last_updated__idx ON bugtaskflat
12+ USING btree (date_last_updated);
13+CREATE INDEX bugtaskflat__datecreated__idx ON bugtaskflat
14+ USING btree (datecreated);
15+CREATE INDEX bugtaskflat__heat__bugtask__idx ON bugtaskflat
16+ USING btree (heat, bugtask DESC);
17+CREATE INDEX bugtaskflat__importance__bugtask__idx ON bugtaskflat
18+ USING btree (importance, bugtask DESC);
19+CREATE INDEX bugtaskflat__status__bugtask__idx ON bugtaskflat
20+ USING btree (status, bugtask DESC);
21+
22+-- And add a Bug.id sort index to each set.
23+CREATE INDEX
24+ bugtaskflat__distribution__bug__bugtask__idx
25+ ON bugtaskflat
26+ USING btree (distribution, bug, bugtask DESC)
27+ WHERE distribution IS NOT NULL;
28+CREATE INDEX
29+ bugtaskflat__distribution__spn__bug__idx
30+ ON bugtaskflat
31+ USING btree (distribution, sourcepackagename, bug)
32+ WHERE distribution IS NOT NULL;
33+CREATE INDEX
34+ bugtaskflat__distroseries__bug__bugtask__idx
35+ ON bugtaskflat
36+ USING btree (distroseries, bug, bugtask DESC)
37+ WHERE distroseries IS NOT NULL;
38+CREATE INDEX
39+ bugtaskflat__distroseries__spn__bug__idx
40+ ON bugtaskflat
41+ USING btree (distroseries, sourcepackagename, bug)
42+ WHERE distroseries IS NOT NULL;
43+CREATE INDEX
44+ bugtaskflat__product__bug__idx
45+ ON bugtaskflat
46+ USING btree (product, bug)
47+ WHERE product IS NOT NULL;
48+CREATE INDEX
49+ bugtaskflat__productseries__bug__idx
50+ ON bugtaskflat
51+ USING btree (productseries, bug)
52+ WHERE productseries IS NOT NULL;
53+CREATE INDEX
54+ bugtaskflat__bug__bugtask__idx
55+ ON bugtaskflat
56+ USING btree (bug, bugtask DESC);
57+
58+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 16, 1);