Merge lp:~jtv/launchpad/bug-802335 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jeroen T. Vermeulen | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 13318 | ||||
Proposed branch: | lp:~jtv/launchpad/bug-802335 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
48 lines (+10/-10) 1 file modified
lib/lp/soyuz/model/queue.py (+10/-10) |
||||
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-802335 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+66148@code.launchpad.net |
Commit message
[r=jtv][bug=802335] Performance problem with new PackageUpload name search.
Description of the change
= Summary =
We recently replaced the PackageUploads search logic on the DistroSeries:+queue page with a whole different code path, part of which was already available and part of which we had to develop for the purpose. The new code would find sync uploads as well as the more traditional types of upload.
The main search query in the new code path can time out when the search criteria include a name pattern. (The name pattern is applied to source package names, binary package names, and filenames for custom uploads).
== Proposed fix ==
The query is a fairly wide join, but not particularly complex. It left-joins various tables that might produce a matching name.
Those joins' conditions were sub-optimal. The join conditions did the name matching (which produces long scans and vast Cartesian products) after which the WHERE conditions established that the joined objects were actually related to the queried uploads.
Switching the two slightly complicates the ordering of the joins, but speeds things up by four orders of magnitude (roughly from a dozen seconds to a bit over a millisecond). No structural or functional changes are needed.
== Tests ==
{{{
./bin/test -vvc lp.soyuz.
}}}
== Demo and Q/A ==
Go to /ubuntu/
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
Julian says to self-review.