Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created January 18, 2021 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/28bb523ea4e39afcf51c8b3ce33088d3 to your computer and use it in GitHub Desktop.
Save kyanny/28bb523ea4e39afcf51c8b3ce33088d3 to your computer and use it in GitHub Desktop.
from django.db import connections,connection,reset_queries
from django.conf import settings
settings.DEBUG = True
def query_count(reset=True):
total = sum(len(c.queries) for c in connections.all())
if reset:
reset_queries()
return total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment