Django Query Profiling
SkillDatabases & dataFind the Django ORM code and request path responsible for slow SQL by using APM traces, slow query logs, Django Debug Toolbar, query logging, and local reproduction. Use when a Django database performance issue is suspected but the exact queryset, view, serializer, template, or job causing it is not yet proven.
Use Django Query Profiling in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Django Query Profiling and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Django Query Profiling 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-profiling/SKILL.md and read by Ahel’s review.
Use this skill to turn a vague slow-Django report into a specific queryset, SQL statement, and reproducible scenario.
Workflow
-
Start from the user-visible slow path.
- Record the URL, API action, background task, management command, or report.
- Capture request parameters, user or tenant shape, pagination state, and data volume.
-
Collect production or staging evidence.
- Prefer APM transaction traces when available.
- Use database slow-query logs for SQL that is slow independent of Python.
- Use Django Debug Toolbar for server-rendered pages in local development.
- For APIs or jobs, add targeted query logging around the suspicious block.
-
Map SQL back to Django code.
- Search model table names and column names.
- Inspect view
get_queryset(), serializer fields, template loops, managers, model properties, and signal handlers. - Check whether related-object access happens after the initial queryset was evaluated.
-
Reproduce locally or in a safe shell.
- Use production-like row counts when possible.
- Disable unrelated instrumentation and debug-only middleware when measuring.
- Keep a repeatable script, test, or shell snippet that exercises the slow path.
-
Route the fix.
- Query count issue: use
django-orm-query-optimization. - One slow SQL statement: use
django-query-plan-reading. - Large loops or writes: use
django-queryset-batch-processing.
- Query count issue: use
See tooling-and-reproduction.md for concrete profiling snippets and pitfalls.
Good Evidence
- Query count before/after for the specific path.
- The slow SQL or normalized SQL fingerprint.
- Stack or code pointer that explains where the SQL originates.
- Timing from the same environment and representative data shape.
Verification
Do not finish profiling with only a hunch. Finish with a named queryset, code path, and command or request that another agent can re-run.
Signals
- GitHub stars
- 1k
- Forks
- 316
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
django-query-profiling- Source
- github.com/hashgraph-online/awesome-codex-plugins
github.com/hashgraph-online/awesome-codex-plugins
Related picks
Skill · wshobson
The pick for Pythonpython-pro
Skill · jeffallan
The pick for Pythondjango-targeted-mocking
Skill · hashgraph-online
The pick for Djangointegration-django
Skill · posthog
The pick for Djangosupabase-postgres-best-practices
Skill · baekenough
The pick for Postgresanalytics
Skill · coreyhaines31
More in Databases & data