Opened 5 years ago
Last modified 5 years ago
#30842 closed Cleanup/optimization
Prefetch_related spends considerable time constructing querysets. — at Initial Version
Reported by: | Alex Aktsipetrov | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | prefetch_related |
Cc: | Simon Charette | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As part of the bugfix django started constructing N+1 querysets during a typical prefetch_related call while only 2 sql queries are executed.
This adds a noticeable slowdown. Attaching the flamegraph for queryset fetching 100 objects.
Note:
See TracTickets
for help on using tickets.