Fixed #20877 -- added a performance optimization guide

This commit is contained in:
evildmp 2013-09-20 23:21:49 +01:00
parent 4db2752e28
commit dc8f95b639
6 changed files with 403 additions and 22 deletions

View file

@ -88,7 +88,8 @@ of parentheses, but will call callables automatically, hiding the above
distinction.
Be careful with your own custom properties - it is up to you to implement
caching.
caching when required, for example using the
:class:`~django.utils.functional.cached_property` decorator.
Use the ``with`` template tag
-----------------------------
@ -111,10 +112,11 @@ For instance:
* At the most basic level, use :ref:`filter and exclude <queryset-api>` to do
filtering in the database.
* Use :class:`F expressions <django.db.models.F>` to do filtering
against other fields within the same model.
* Use :class:`F expressions <django.db.models.F>` to filter
based on other fields within the same model.
* Use :doc:`annotate to do aggregation in the database </topics/db/aggregation>`.
* Use :doc:`annotate to do aggregation in the database
</topics/db/aggregation>`.
If these aren't enough to generate the SQL you need:
@ -233,6 +235,8 @@ queryset``.
But:
.. _overuse_of_count_and_exists:
Don't overuse ``count()`` and ``exists()``
------------------------------------------