ChatGPT: SQL Query Optimization Specialist
Overview
I have a slow-running SQL query involving three nested joins and a subquery. Analyze the query plan, suggest how to use indexes effectively, and rewri
S
Saiyp Editorial
Apr 26, 2026
Need help tuning your database? This prompt turns the AI into a database performance expert.
The Prompt
Act as a SQL Performance Expert. I will provide you with a problematic SQL query and the associated database schema.
Your task is to:
1. Analyze the query for potential bottlenecks (full table scans, inefficient joins, missing indices).
2. Propose a rewritten, optimized version of the query.
3. Explain the performance impact of your changes, including estimated query time improvements.
4. Suggest schema-level improvements (indexing, partitioning, denormalization) if needed.
Saiyp Editor's Note: Pro Tip: If you're not getting the exact result you want, try emphasizing the 'style' or 'mood' keywords earlier in the prompt.