Merge lp:~jtv/launchpad/db-bug-518965 into lp:launchpad/db-devel

Proposed by Jeroen T. Vermeulen
Status: Rejected
Rejected by: Jeroen T. Vermeulen
Proposed branch: lp:~jtv/launchpad/db-bug-518965
Merge into: lp:launchpad/db-devel
Diff against target: 9 lines (+5/-0)
1 file modified
database/schema/patch-2207-99-0.sql (+5/-0)
To merge this branch: bzr merge lp:~jtv/launchpad/db-bug-518965
Reviewer Review Type Date Requested Status
Jonathan Lange (community) Approve
Canonical Launchpad Engineering db Pending
Review via email: mp+19091@code.launchpad.net

Commit message

Index Bug(datecreated, id).

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 518965 =

We've got a query timing out on the Bugs front page. The query was ordered by datecreated, with id as a tie-breaker. It's good for determinacy to have such a tie-breaker, but there was only an index on datecreated. The query itself would run in a fraction of a millisecond, but the sorting could take several seconds.

This branch adds an index on (datecreated, id). As a result, this particular query needs no sorting at all.

Jeroen

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The old (datecreated, id) ordering is no longer appearing in long queries in the oops reports, so this particular performance problem is already solved.

Revision history for this message
Jonathan Lange (jml) wrote :

Fine by me, but it needs approval from stub.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2207-99-0.sql'
2--- database/schema/patch-2207-99-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2207-99-0.sql 2010-02-11 11:40:36 +0000
4@@ -0,0 +1,5 @@
5+SET client_min_messages=ERROR;
6+
7+CREATE INDEX bug__datecreated__id__idx ON Bug(datecreated, id);
8+
9+-- INSERT INTO LaunchpadDatabaseRevision VALUES (2207, XXX, 0)

Subscribers

People subscribed via source and target branches

to status/vote changes: