Merge lp:~wallyworld/launchpad/bugtask-index-queries-726370 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | William Grant |
Approved revision: | no longer in the source branch. |
Merged at revision: | 16119 |
Proposed branch: | lp:~wallyworld/launchpad/bugtask-index-queries-726370 |
Merge into: | lp:launchpad |
Diff against target: |
62 lines (+37/-3) 2 files modified
lib/lp/bugs/browser/bugtask.py (+12/-3) lib/lp/bugs/browser/tests/test_bugtask.py (+25/-0) |
To merge this branch: | bzr merge lp:~wallyworld/launchpad/bugtask-index-queries-726370 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+128850@code.launchpad.net |
Commit message
Precache all bug activity persons to avoid individual queries on bugtask index page.
Description of the change
== Implementation ==
The bug activities rendered on the bugtask page were being iterated one by one and the activity person loaded. This caused 2 queries per activity person - one to select from Person and the other to select from ValidCache. This branches caches all activity people with a single query to prevent the linear growth in queries for this bit of the index page rendering.
== Tests ==
Add a new query count test for bugtasks with activities.
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
As discussed on IRC, most of the invasive changes are unnecessary. Since it's a FK to the PK, you just need to materialise the resultset from getPrecachedPer sonsFromIDs. Other than that this is great.