Skip to content

Instantly share code, notes, and snippets.

View python_pr.md

Django Performance Guidelines

ORM

  • Incorrect usage of the Django ORM is a common cause of performance issues. Therefore, it is important to know when querysets are evaluated (i.e., hit the database)
  • Use exists() to check if a queryset has any results in it.
    • Good:
     queryset = Account.objects.filter(some_attribute=True)
    
View gist:1441eede2f85dd0cde4a
♥ git checkout -b experimental-theories
Switched to a new branch 'experimental-theories'