Merge lp:~lifeless/launchpad/bug-121363 into lp:launchpad/db-devel

Proposed by Robert Collins
Status: Merged
Merged at revision: 9802
Proposed branch: lp:~lifeless/launchpad/bug-121363
Merge into: lp:launchpad/db-devel
Diff against target: 24 lines (+15/-0)
2 files modified
database/schema/patch-2208-08-3.sql (+8/-0)
database/schema/patch-2208-15-0.sql (+7/-0)
To merge this branch: bzr merge lp:~lifeless/launchpad/bug-121363
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Review via email: mp+35971@code.launchpad.net

Commit message

Permit bug searches ordered by date_closed desc, id to come from index.

Description of the change

Permit bug searches ordered by date_closed desc, id to come from index.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

If the existing index is actually being used to order other queries, we could just add the new one.

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

The CREATE INDEX needs to be in a separate patch because we will be applying it live. patch-2208-08-3.sql.

The DROP INDEX can go in patch-2208-15-0.sql

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-2208-08-3.sql'
2--- database/schema/patch-2208-08-3.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2208-08-3.sql 2010-09-20 02:15:58 +0000
4@@ -0,0 +1,8 @@
5+SET client_min_messages=ERROR;
6+
7+-- Permit bug searches ordered by 'date_closed desc, id' to serve from
8+-- index rather than doing the full search and sorting.
9+
10+CREATE INDEX bugtask__date_closed__id__idx2 ON BugTask (date_closed, id desc nulls first);
11+
12+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 8, 3);
13
14=== added file 'database/schema/patch-2208-15-0.sql'
15--- database/schema/patch-2208-15-0.sql 1970-01-01 00:00:00 +0000
16+++ database/schema/patch-2208-15-0.sql 2010-09-20 02:15:58 +0000
17@@ -0,0 +1,7 @@
18+SET client_min_messages=ERROR;
19+
20+-- Delete index obsoleted by bugtask__date_closed__id__idx2
21+
22+DROP INDEX bugtask__date_closed__id__idx;
23+
24+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 15, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: