Closed Bug 782803 Opened 13 years ago Closed 7 years ago

Reduce SQL queries needed by Kuma wiki feeds

Categories

(developer.mozilla.org Graveyard :: Editing, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: lorchard, Unassigned)

References

Details

Currently, the feeds for Documents and Revisions in Kuma perform 3 SQL queries for each item in the feed. So, if a feed has a limit of 100 items, this fires off 300 DB queries. It looks like this can be reduced by using prefetch_related() [1] to build a proper JOIN query, but that requires a Django 1.4 upgrade. This could probably be fixed by just using raw SQL, but that feels painful. [1] https://docs.djangoproject.com/en/1.4/ref/models/querysets/#prefetch-related
Oh, and the 3 queries are each to wiki_revision (for current_revision), auth_user (for authorship info), and wiki_documenttag (for categories). These could probably just all be rolled into the same request that fetches Documents. An exception might be wiki_documenttag, at least not without some fancy raw SQL. We may want to refrain from including tag links in feeds, or hide them behind an option.
Component: Website → Docs Platform
Priority: -- → P3
Version: Kuma → unspecified
Component: Docs Platform → Editing
See Also: → 1159431
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.