PROFESSIONAL DJANGO ENGINEERING SERIES #6 If you have never read a query execution plan, you are flying blind on database performance. Here is how to read one — and what the warning signs look like. Django's ORM is excellent at writing SQL. It is not excellent at telling you whether that SQL is fast. For that, you need to go one level deeper — to the database itself, and to the execution plan it generates for every query you run. EXPLAIN ANALYZE is PostgreSQL's most powerful diagnostic tool. It shows you not just what SQL your query produces, but how the database engine plans to execute it, how long it actually takes, and — most usefully — where it is spending that time. Most Django performance problems are database problems. Most database problems are index problems. And most index problems are invisible until you look at the query plan.…