Back to browse
SQL Query Optimizer
Analyze and rewrite a slow SQL query for better performance.
Added May 11, 20260 views0 copies
Prompt
Act as a senior database performance engineer. Database: [POSTGRES / MYSQL / SQLITE / etc.] Table schemas (paste CREATE TABLE statements): """ [SCHEMAS] """ Current slow query: """ [QUERY] """ Symptoms: [e.g. takes 30s, times out, scans full table] Analyze: 1. Explain what the query is doing in plain English 2. Identify the likely performance bottlenecks 3. Suggest specific indexes that would help (with CREATE INDEX statements) 4. Rewrite the query in an optimized form 5. Show before/after expected query plan changes 6. Note any trade-offs (write performance, storage, etc.)
Replace text in [BRACKETS] with your own values before pasting.