Give it the handler and the ORM models. Asking for a query count first stops it from guessing.
The prompt is below. Replace the parts in [square brackets] with your own details.
Posted November 20, 2026
Here is a request handler and its models: code.
Count the database queries one request makes for a page of number items, and show the arithmetic.
Find every N+1 pattern and say which relation triggers it.
Rewrite using eager loading or one batched query, and state the new query count.
Tell me which index each rewritten query needs, and how to confirm it with EXPLAIN.
No other refactors.
Finish with a regression test that fails if the query count for this page ever exceeds your new number.
Your words
Open to everyone
Give it the handler and the ORM models. Asking for a query count first stops it from guessing.
The prompt is below. Replace the parts in [square brackets] with your own details.
3 views · 0 replies
Sign in or create a free account to reply. It costs nothing.
Already a member? Sign in