About SQL Query Inspection
When in DEBUG mode, you can inspect the latest executed SQL queries and their execution time with:
>>> from django.db import connection
>>> connection.queries
[{'sql': 'SELECT …', 'time': '0.001'},
{'sql': 'SELECT …', 'time': '0.004'}]
Tips and Tricks Development Databases Optimization Django 4.2 Django 3.2 Django 2.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.