Merge lp:~allenap/launchpad/localpackagediffs-time-out-bug-798301 into lp:launchpad
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Gavin Panella | ||||
Proposed branch: | lp:~allenap/launchpad/localpackagediffs-time-out-bug-798301 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
119 lines (+56/-11) 1 file modified
lib/lp/registry/model/distroseriesdifference.py (+56/-11) |
||||
To merge this branch: | bzr merge lp:~allenap/launchpad/localpackagediffs-time-out-bug-798301 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen | Pending | ||
Review via email: mp+65426@code.launchpad.net |
Description of the change
A small warning: this branch has been born in an atmosphere of
frustration with PostgreSQL and Storm, most especially Storm.
The query that most_recent_
pathological query performance as the number of DSDs queried against
grows. Changing the number of DSDs from 75 to 300 causes a tenfold
increase in execution time.
Some experimentation against production with alternative queries -
forcing inner joins, using temporary tables, using WITH clauses - has
yielded similar or worse performance. The only approach that has shown
promise (and quite a lot of promise: query time down from ~6s to 0.6s)
is breaking the query into small batches and then UNIONing them back
together. A DISTINCT ON clause needs to be applied to the set as a
whole.
However, Storm does not make this easy. See bug 799824 for that. Most
of the complexity in this branch is working around that annoying bug.
Unmerged revisions
- 13253. By Gavin Panella
-
Split the query into batches of around 35 DSDs at a time, and UNION it back together.
As discussed on IRC: I too find the union trick highly suspicious. And I question the shape of the join:
* Shouldn't the SPPHs be filtered by distroseries?
* Can't the Archive.status check be done outside of the query?
* Does the query really need DSD?
In the extreme lucky case where all of these questions hit pay dirt, you'd end up with a join between just SPPH and SPR.