Merge lp:~cjohnston/qa-dashboard/bootspeed-raw-queries into lp:qa-dashboard

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 705
Merged at revision: 705
Proposed branch: lp:~cjohnston/qa-dashboard/bootspeed-raw-queries
Merge into: lp:qa-dashboard
Diff against target: 18 lines (+7/-1)
1 file modified
bootspeed/views.py (+7/-1)
To merge this branch: bzr merge lp:~cjohnston/qa-dashboard/bootspeed-raw-queries
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Andy Doan (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+200621@code.launchpad.net

Commit message

Reduce the queries for the bootspeed raw data page.

Description of the change

It was brought to my attention today that the bootspeed raw data page loads very slowly. After some initial investigation I noticed that the page has approx 4000 db queries. This small MP took the queries to approx 1350 queries per my testing.

To post a comment you must log in.
705. By Chris Johnston

Reduces bootspeed raw data queries

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:705
http://s-jenkins.ubuntu-ci:8080/job/dashboard-ci/283/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/dashboard-ci/283/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andy Doan (doanac) :
review: Approve
Revision history for this message
Chris Johnston (cjohnston) wrote :

 merge approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bootspeed/views.py'
2--- bootspeed/views.py 2013-06-28 16:21:15 +0000
3+++ bootspeed/views.py 2014-01-07 02:52:33 +0000
4@@ -151,7 +151,13 @@
5 def machine_raw_data(request, machine_id, arch):
6 machine = get_object_or_404(Machine, id=machine_id)
7
8- qs = ImageResult.objects.filter(machine__id=machine_id, image__arch=arch)
9+ qs = ImageResult.objects.filter(
10+ machine__id=machine_id,
11+ image__arch=arch,
12+ ).prefetch_related(
13+ 'image',
14+ 'machine',
15+ )
16
17 data = []
18 for q in qs:

Subscribers

People subscribed via source and target branches