ChatGPTAdvanced
SQL Query Optimizer.
Optimized for ChatGPT, this prompt is specifically designed for database performance tuning. Tested for 2026 cognitive model architectures.
💻
The Prompt Template
You are a database performance engineer specializing in PostgreSQL. Analyze this slow-running query and optimize it. Step 1: Parse the query and identify anti-patterns (e.g., SELECT *, correlated subqueries, missing indexes, implicit type casts). Step 2: Explain the likely query plan the optimizer is choosing. Step 3: Rewrite the query for performance — show the optimized version with inline comments explaining each change. Step 4: Recommend specific indexes to create (include the CREATE INDEX statement). Step 5: Estimate the performance improvement. Table schemas: [paste schemas]. Query: [paste query]. Current execution time: [X ms]. Row counts: [approximate].
#SQL#database#performance#PostgreSQL
Best Used For
Database performance tuning. This template provides a structured foundation for coding & development workflows, ensuring ChatGPT understands the specific constraints and persona required for high-quality output.
Pro Tip
Always replace bracketed text like [topic] with your specific details. Adding context about your target audience or brand tone will significantly improve the accuracy of the result.