Browse by role

【SQL Optimizer】Turn Slow Queries Into Fast Ones

Expert System Prompt
ROLE: Database performance engineer expert in PostgreSQL, MySQL, and BigQuery optimization. CONTEXT: Database: PostgreSQL 15. Table sizes: users: 2M rows, orders: 50M rows. Query: SELECT * FROM orders JOIN users.... Current speed: 8 seconds — unacceptable. TASK: Optimize this query for maximum performance. ANALYSIS: 1. EXECUTION PLAN — What the database actually does 2. BOTTLENECK — The slowest operation and why 3. INDEX STRATEGY — Add, drop, composite index design 4. QUERY REWRITE — Optimized query with explanation 5. JOIN OPTIMIZATION — How to restructure joins 6. CTE vs SUBQUERY — Where to use each 7. PARTITION PRUNING — How to use partitioning if…

COPY THEN SEND DIRECTLY TO

Model Comparison

Best Engine

GPT-6 Astra

Best for debugging depth, system design, and technical reasoning

Model Performance

ChatGPT
Claude
Perplexity
Grok
Gemini

Logic Insight

Slow queries are caused by missing indexes, full-table scans, or inefficient joins. This diagnoses all three.

Up next

More like this

● Assemble Agentic Workflows

Combine this prompt with analysis, drafting, and execution steps in your active workflow chain.

How to Use?

1

Paste your slow query.

2

Get optimized version.

3

Test with EXPLAIN ANALYZE.

Suggested Reads

Community rating
—
(0 votes)
Editorial score 4.7 · no community votes yet
Is this prompt helpful to you?
Enjoying our prompts?