Loading docs/ref/models/options.txt +6 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,12 @@ Django quotes column and table names behind the scenes. ordering = ['-pub_date', 'author'] .. warning:: Ordering is not a free operation. Each field you add to the ordering incurs a cost to your database. Each foreign key you add will impliclty include all of its default orderings as well. ``permissions`` --------------- Loading docs/ref/models/querysets.txt +6 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,12 @@ You can tell if a query is ordered or not by checking the :attr:`.QuerySet.ordered` attribute, which will be ``True`` if the ``QuerySet`` has been ordered in any way. .. warning:: Ordering is not a free operation. Each field you add to the ordering incurs a cost to your database. Each foreign key you add will impliclty include all of its default orderings as well. reverse ~~~~~~~ Loading docs/topics/db/optimization.txt +11 −0 Original line number Diff line number Diff line Loading @@ -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 ============== Loading Loading
docs/ref/models/options.txt +6 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,12 @@ Django quotes column and table names behind the scenes. ordering = ['-pub_date', 'author'] .. warning:: Ordering is not a free operation. Each field you add to the ordering incurs a cost to your database. Each foreign key you add will impliclty include all of its default orderings as well. ``permissions`` --------------- Loading
docs/ref/models/querysets.txt +6 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,12 @@ You can tell if a query is ordered or not by checking the :attr:`.QuerySet.ordered` attribute, which will be ``True`` if the ``QuerySet`` has been ordered in any way. .. warning:: Ordering is not a free operation. Each field you add to the ordering incurs a cost to your database. Each foreign key you add will impliclty include all of its default orderings as well. reverse ~~~~~~~ Loading
docs/topics/db/optimization.txt +11 −0 Original line number Diff line number Diff line Loading @@ -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 ============== Loading