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

Proposed by Jeroen T. Vermeulen on 2010-02-11
Status: Rejected
Rejected by: Jeroen T. Vermeulen on 2010-02-11
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 on 2010-02-11
Canonical Launchpad Engineering db 2010-02-11 Pending
Review via email: mp+19091@code.launchpad.net

Commit Message

Index Bug(datecreated, id).

To post a comment you must log in.
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

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.

Jonathan Lange (jml) wrote :

Fine by me, but it needs approval from stub.

review: Approve

Unmerged revisions

8982. By Jeroen T. Vermeulen on 2010-02-10

Missing index was causing timeouts on the Bugs front page.

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: