Django Queryset only () and defer ()

In the real world, how often do people use QuerySet methods, such as defer()and only()? I believe that I really heard a lot about them, and only recently I came across these methods.

See Docs here. https://docs.djangoproject.com/en/dev/ref/models/querysets/

+5
source share
2 answers

These methods are mainly used to optimize the performance of your application.

Generally speaking, if you have no performance issues, you do not need to optimize. And if you do not need to optimize, you do not need these functions. This is a case with many advanced QuerySetfeatures such as select_relatedor prefetch_related.

", ", . , . , .

+11

defer() only() . field_names. defer() , , . only() , .

,

  • ,

  • Python. Eg.Admin X . cols, Y . cols, z no cols.

+1

All Articles