Skip to content

Django Zen Queries are training wheels

django-zen-queries is a great little package that helps you track down and eliminate those annoying N+1 queries and more.

However I consider this a training wheel, let me explain. Once you've moved all queries to your view code and execute them before passing the data to your template rendering, any template fragment caching with {% cache %} becomes a lot less useful. Sure, you still save on rendering time but nothing is saved on database access which is often the slowest part of many applications.

The best way to use zen queries is by only using them during development together with tools like DDT. When it's time to deploy to production you remove the training wheels and let your application fly.