diff options
author | Simon Charette <charettes@users.noreply.github.com> | 2019-10-14 06:51:07 -0400 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-10-14 12:53:32 +0200 |
commit | f037ae11ec97f90ff94fbff2cdae336619ae63c5 (patch) | |
tree | cc58f8e20efe575b10090659f5bc57dad524e558 | |
parent | d2f02aa56b57f8b3de1b624f8b1a909c67b6823a (diff) | |
download | django-f037ae11ec97f90ff94fbff2cdae336619ae63c5.tar.gz |
[2.2.x] Refs #26207 -- Removed obsolete note about slow constructing a model with deferred fields.
This is not true since 7f51876 removed the necessity of creating
proxy model classes at runtime for each deferred field sets.
Backport of 35396a7f243eceec42cc90725ab573a7d9ac3b4c from master
-rw-r--r-- | docs/topics/db/optimization.txt | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt index 9d22b980bd..6e5ccd0290 100644 --- a/docs/topics/db/optimization.txt +++ b/docs/topics/db/optimization.txt @@ -233,14 +233,12 @@ you know that you won't need (or won't need in most cases) to avoid loading them. Note that if you *do* use them, the ORM will have to go and get them in a separate query, making this a pessimization if you use it inappropriately. -Also, be aware that there is some (small extra) overhead incurred inside -Django when constructing a model with deferred fields. Don't be too aggressive -in deferring fields without profiling as the database has to read most of the -non-text, non-VARCHAR data from the disk for a single row in the results, even -if it ends up only using a few columns. The ``defer()`` and ``only()`` methods -are most useful when you can avoid loading a lot of text data or for fields -that might take a lot of processing to convert back to Python. As always, -profile first, then optimize. +Don't be too aggressive in deferring fields without profiling as the database +has to read most of the non-text, non-VARCHAR data from the disk for a single +row in the results, even if it ends up only using a few columns. The +``defer()`` and ``only()`` methods are most useful when you can avoid loading a +lot of text data or for fields that might take a lot of processing to convert +back to Python. As always, profile first, then optimize. Use ``QuerySet.count()`` ------------------------ |