Order 'most recently closed' on 'Bugtask.id DESC' instead of 'BugTask.id'

Bug #121363 reported by Björn Tillenius
6
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Robert Collins

Bug Description

The query for find the most recently closed bugs currently takes quite a long time to execute, since some index isn't being used. We need to change it to order by 'BugTask.id DESC' instead of 'BugTask.id'

Bug 43821 is related.

Related branches

Revision history for this message
Christian Reis (kiko) wrote :

Major oopser.

Changed in malone:
importance: Undecided → Critical
status: Unconfirmed → Confirmed
Christian Reis (kiko)
Changed in malone:
importance: Critical → High
Changed in malone:
assignee: nobody → schwuk
David Murphy (schwuk)
Changed in malone:
status: Confirmed → In Progress
David Murphy (schwuk)
Changed in malone:
milestone: 1.1.10 → 1.1.11
Christian Reis (kiko)
Changed in malone:
assignee: schwuk → allenap
Revision history for this message
Gavin Panella (allenap) wrote :

Bjorn, I discussed this with you briefly, and it seemed as though the root problem had been lost in the mists of time.
Reminder to self: get an explain plan of the relevant query for before/after this change to try and discover the root problem.

Changed in malone:
milestone: 1.1.11 → 1.2.1
Revision history for this message
Björn Tillenius (bjornt) wrote :

Stuart, do you remember what needs to be done to fix this bug?

As far as I know, this bug isn't causing any timeouts. Is this something that we have to fix, or can we drop this bug? I'm unassigning the bug from any milestone until we know more about the problem.

Changed in malone:
importance: High → Medium
milestone: 1.2.1 → none
status: In Progress → Incomplete
Revision history for this message
Stuart Bishop (stub) wrote :

At the moment, when bugs are ordered by 'most recently closed' the ORDER BY clause is ORDER BY date_closed DESC, id. The id is there to make the results deterministic in the test suite (in real life, it is unnecessary). This ORDER BY clause is unable to use the index created to make this query run quickly. The ORDER BY should be ORDER BY date_closed DESC, id DESC.

The fix may just be a case of finding the relevant order_by parameter and inserting a '-' sign.

Changed in malone:
status: Incomplete → Triaged
Gavin Panella (allenap)
Changed in malone:
assignee: Gavin Panella (allenap) → nobody
Revision history for this message
Robert Collins (lifeless) wrote :

High as per oops policy; our test needs should never impact production speed: we can write things to cater for production's needs in a more sophisticated way; still : remaining action here is to find an example oops and fix. If its still happening.

Changed in malone:
importance: Medium → High
Revision history for this message
Robert Collins (lifeless) wrote :

https://bugs.edge.launchpad.net/malone/+bug/606914 seems to be related - Stuart makes the same comment in both bugs.

Revision history for this message
Robert Collins (lifeless) wrote :

sorting by id is also a nice UI thing, on reflection. Perhaps we should make the index:
CREATE INDEX bugtask__date_closed__id__idx ON BugTask (date_closed, id desc nulls first);

which will support ORDER BY date_closed desc, id

Changed in malone:
status: Triaged → In Progress
assignee: nobody → Robert Collins (lifeless)
Revision history for this message
Robert Collins (lifeless) wrote :

Fixed and deployed \o/

Changed in malone:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
milestone: none → 10.10
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit

Fixed in db-stable r9802 (http://bazaar.launchpad.net/~launchpad-pqm/launchpad/db-stable/revision/9802) by a commit, but not testable.

tags: added: qa-untestable
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.