More in this categoryCoding Prompts
05 / 12
2-phase workflow
Query to Optimized Query
Get a working query, then optimize it for scale.
Published · Updated

Workflow · 2 phases
Phase 1: Phase 1 — Working query
Generate a [DATABASE] query that [BASIC NEED]. Just get the correct results first — clarity over speed. Query: describe what you need in plain words.
Phase 2: Phase 2 — Optimize it
Now optimize that query for a table with 10M+ rows: rewrite with proper indexes in mind, eliminate N+1 patterns, and explain which index you would add and why. Show EXPLAIN-style reasoning.
Related prompts
Coding Prompts2 phasesLegacy Code Modernization
Analyze legacy risks, then modernize safely.
- Amazon Q Developer
By Rahul Verma
Coding Prompts2 phasesFunction Draft to Production-Ready
Draft a working function, then harden it for production.
- GitHub Copilot
By Priya Sharma
Coding Prompts
Coding Prompts2 phases