Closed Bug 1179897 Opened 9 years ago Closed 9 years ago

Reduce select queries to wiki_revision during kuma.users.views:profile_view

Categories

(developer.mozilla.org Graveyard :: Performance, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: groovecoder, Assigned: jezdez)

References

Details

(Keywords: in-triage)

New Relic reports kuma.wiki.views:profile_view transaction makes an average of 5.81 select queries to wiki_revision, taking an average of 271ms. [1]

We should reduce the number of queries as much as possible; first target 2.5x queries <150ms.

[1] https://rpm.newrelic.com/accounts/263620/applications/3172075/transactions#id=5b225765625472616e73616374696f6e2f46756e6374696f6e2f6b756d612e75736572732e76696577733a70726f66696c655f76696577222c22225d
Assignee: nobody → jezdez
Status: NEW → ASSIGNED
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/f317947a9291fe8e2c542c22937fe06a9dbe5ae4
Fix bug 1179897 - Reduce number of db queries on profile page.

This does a bunch of things:

- Move revision helper to custom user model (ref bug 1180208).
- Use else clause for for loop for getting rid of slow count query.
- Prefetch revision documents to reduce related queries.
- Use a cached property for the previous revision for in-page load caching.

Signed-off-by: Jannis Leidel <jannis@leidel.info>

https://github.com/mozilla/kuma/commit/f07c301c05660a117a5cd91182998019e1854dd5
Merge pull request #3306 from mozilla/bug1179897

Fix bug 1179897 - Reduce number of db queries on profile page.

r=jezdez
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.