diff options
| author | e0ne <e0ne@e0ne.info> | 2013-09-08 22:57:36 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-09-09 09:47:18 -0400 |
| commit | cbf08c6b0ca39406cada4bd1ffc6d334a79822e8 (patch) | |
| tree | 3dc20ded864ea96efc0a934d70eb27ebed02a2e7 /docs/topics | |
| parent | 1185370c2c7e66428c45c69e960d10198e17e367 (diff) | |
Fixed #16895 -- Warned about cost of QuerySet ordering
Thanks outofculture at gmail.com for the suggestion.
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/db/optimization.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt index c99c84d9fa..ea919d76f8 100644 --- a/docs/topics/db/optimization.txt +++ b/docs/topics/db/optimization.txt @@ -306,6 +306,17 @@ instead of:: entry.blog.id +Don't order results if you don't care +------------------------------------- + +Ordering is not free; each field to order by is an operation the database must +perform. If a model has a default ordering (:attr:`Meta.ordering +<django.db.models.Options.ordering>`) and you don't need it, remove +it on a ``QuerySet`` by calling +:meth:`~django.db.models.query.QuerySet.order_by()` with no parameters. + +Adding an index to your database may help to improve ordering performance. + Insert in bulk ============== |
