Last active
November 16, 2020 09:05
-
-
Save myungseokang/ecd3993980d2204c317390da8b1668ad to your computer and use it in GitHub Desktop.
Get query info in django view
This file contains 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, reset_queries | |
print(len(connection.queries)) | |
reset_queries() |
This file contains 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 | |
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