Skip to content

Instantly share code, notes, and snippets.

@alexphelps
Created September 14, 2017 15:28
Show Gist options
  • Save alexphelps/441cd1a26c6d92e5f9f29c22b388e9ac to your computer and use it in GitHub Desktop.
Save alexphelps/441cd1a26c6d92e5f9f29c22b388e9ac to your computer and use it in GitHub Desktop.
Django DB Query Info Time & Count
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