Django Query Plan Reading
SkillDatabases & dataRead and compare Django/PostgreSQL query execution plans using QuerySet.explain(), EXPLAIN, EXPLAIN ANALYZE, scan types, joins, estimates, actual timing, buffers, and row counts. Use when one SQL query dominates Django latency or when an index, ORM rewrite, pagination change, or materialized view needs proof from a query plan.
Use Django Query Plan Reading in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Django Query Plan Reading and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Django Query Plan Reading skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by hashgraph-online/awesome-codex-plugins in plugins/LVTD-LLC/skills/skills/django-query-plan-reading/SKILL.md and read by Ahel’s review.
Use this skill when the expensive unit is a specific SQL statement or queryset. The goal is to explain why the database is doing work, not to guess from the ORM code.
Workflow
-
Get the exact query.
- Prefer the queryset that produced it.
- If starting from logged SQL, include bound parameters or representative literals.
-
Generate a plan.
- Use
queryset.explain()for ORM-owned SQL. - Use database
EXPLAINfor raw SQL, views, materialized views, or SQL copied from logs. - Use
analyze=Trueonly in a safe environment because the database executes the query.
- Use
-
Read from the deepest node outward.
- Identify table scans, index scans, joins, sorts, aggregations, and limits.
- Compare estimated rows with actual rows when using analyze.
- Look for high-cost nodes that feed many rows to later nodes.
-
Decide the next change.
- Missing selective access path: use
django-index-design. - Query shape prevents useful index access: rewrite filters, ordering, or join strategy.
- Large unavoidable aggregation: consider
django-db-side-computationordjango-materialized-views. - Deep offset cost: use
django-pagination-performance.
- Missing selective access path: use
-
Re-run the same plan after the change.
- Compare scan type, row counts, sort nodes, heap fetches, buffers, planning time, and execution time.
See explain-checklist.md for plan-reading cues and before/after review notes.
Safety Notes
EXPLAIN ANALYZEexecutes the query. Avoid it for mutations, unsafe functions, and production paths unless you know the impact.- A sequential scan is not automatically bad. It can be best when the table is small or the predicate returns much of the table.
- A used index is not automatically good. Random heap access, bad cardinality estimates, or a post-index sort can still dominate.
Verification
Finish with the before/after plan excerpt and a plain explanation of which node changed and why that matters.
Signals
- GitHub stars
- 1k
- Forks
- 316
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
django-query-plan-reading- Source
- github.com/hashgraph-online/awesome-codex-plugins
github.com/hashgraph-online/awesome-codex-plugins
Related picks
Skill · hashgraph-online
The pick for Djangointegration-django
Skill · posthog
The pick for Djangosupabase-postgres-best-practices
Skill · baekenough
The pick for Postgrespython-performance-optimization
Skill · wshobson
The pick for Pythonpython-pro
Skill · jeffallan
The pick for Pythonanalytics
Skill · coreyhaines31
More in Databases & data