Is there a way to find out how many SQL queries made by django app. when I try to load a page? What I like to do as I browse from page to page.. is to record the following in a text file... or see it in stdout.
is there such tool/script?
Cheers
Q object encapsulates a SQL expression in a Python object that can be used in database-related operations. Using Q objects we can make complex queries with less and simple code. For example, this Q object filters whether the question starts wiht 'what': from django. db.
Documentation and source is available at http://django-debug-toolbar.readthedocs.io/. debug_toolbar is especially useful when you have a query that's failing with a SQL syntax error; it will display the last query that attempted to run (and failed), making it easier to debug.
Use debug_toolbar app, it prints not only number of queries, but each one of them and how long they took to run + a lot more useful info.
One thing to remember - this app makes django use quite a bit more memory, so it's best used only in the test environment.
Here is a related question with good answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With