I know that it is possible to get all the SQL queries that were run for the current request/response when DEBUG is on by looking at connection.queries. The django-debug-toolbar also helps a lot on development.

The problem is that my production server is under high load and I would like to log the queries that are being executed for each view so I can optimize the pages that are creating more queries first.

Is it possible to do that without modifying my database driver?

Edit
Report