documentation should warn of cost of ordering
|Reported by:||outofculture@…||Owned by:||e0ne|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
In https://docs.djangoproject.com/en/dev/ref/models/options/#ordering it makes no mention of the database cost of ordering, especially for ordering on non-indexed fields, or the implicit joins of chained orderings. (It doesn't even mention that it chains orderings!) https://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by is another location where the cost might be mentioned. It could additionally go in https://docs.djangoproject.com/en/dev/topics/db/optimization/#don-t-retrieve-things-you-don-t-need as a hint for things to look for when optimizing.
Recommend for model options and querysets pages: "Warning: Ordering is not a free operation. Each field you add to the ordering will incur a cost from your database. Each foreign key you add will include all of its default orderings implicitly."
Recommend for optimization page: "==Don't order if you don't care== Ordering is not free; each field added is an operation the database has to perform."
Change History (7)
comment:1 Changed 4 years ago by ptone
- Needs documentation set
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:3 Changed 2 years ago by e0ne
- Has patch set
- Owner changed from nobody to e0ne
- Status changed from new to assigned
comment:4 Changed 2 years ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from assigned to closed