Skip to content

Instantly share code, notes, and snippets.

@myungseokang
Last active November 16, 2020 09:05
Show Gist options
  • Save myungseokang/ecd3993980d2204c317390da8b1668ad to your computer and use it in GitHub Desktop.
Save myungseokang/ecd3993980d2204c317390da8b1668ad to your computer and use it in GitHub Desktop.
Get query info in django view
from django.db import connection, reset_queries
print(len(connection.queries))
reset_queries()
from django.db import connection
print(sum(float(query['time']) for query in connection.queries))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment