Comment 7 for bug 252674

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

This query looks for the 5 most recently closed bugs. Best solution I've found so far for speeding it up is to limit it to just BugTasks with a date_closed in (say) the last month. (That also changes current behaviour: the current query also includes fix-released BugTasks that don't have a date_closed, and those nulls come out of the sort first, which is probably not what's intended).

A subquery retrieving only distinct bug ids among the recently fix-released bugtasks is quite fast. After that it's no problem to join to Bug etc. and sort by date_closed. Adding in the private bugs that the current user is subscribed to (not shown above) is still slow, but if you retrieve the private-subscribed bugs and the public ones in separate queries you get your results much faster than querying them together with an "OR" clause added in.