Django Queryset only() and defer()

These methods are mostly of use when optimizing performance of your application.

Generally speaking, if you are not having performance problems, you don’t need to optimize. And if you don’t need to optimize, you don’t need these functions. This is a case with a lot of advanced QuerySet features, such as select_related or prefetch_related.

As for “how often they are used in the real world”, that isn’t really an answerable question. They are used when they’re needed. If you don’t need them, don’t use them.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)