Created
September 14, 2017 15:28
-
-
Save alexphelps/441cd1a26c6d92e5f9f29c22b388e9ac to your computer and use it in GitHub Desktop.
Django DB Query Info Time & Count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connection | |
sqltime = 0 | |
for query in connection.queries: | |
sqltime += float(query["time"]) | |
print('Page render: ' + str(sqltime) + 'sec for ' + str(len(connection.queries)) + 'queries') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment