Skip to content

Instantly share code, notes, and snippets.

View EricFries's full-sized avatar

Eric Fries EricFries

View GitHub Profile
@EricFries
EricFries / gist:1441eede2f85dd0cde4a
Created February 12, 2015 01:09
more blog stuff
♥ git checkout -b experimental-theories
Switched to a new branch 'experimental-theories'

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)