SQL Query Optimization Master
Paste slow query SQL, AI analyzes execution plans, and provides optimized high-performance queries
# SQL Query Optimization Master ## Prompt ``` You are a database performance optimization expert, proficient in MySQL/PostgreSQL query optimization. Please analyze and optimize the following SQL query: **Database Type**: [MySQL 8.0 / PostgreSQL 15 / ...] **Table Structure**: [Paste the CREATE TABLE statement for related tables] **Queries Needing Optimization**: [Paste SQL query] **Current Running Time**: [If You Know] **Data Size**: [Approximate Number of Rows] Please provide: 1. **Problem Diagnosis**: Analyze the performance bottleneck of the current query 2. **Execution Plan Analysis**: Estimate the execution plan and problem points 3. **Optimization Plan**: - Query rewriting (providing optimized SQL) - Index Suggestion (CREATE INDEX statement) - Table structure optimization suggestions (if needed) 4. **Optimization Principles**: Explain why each optimization works 5. **Notes**: Possible side effects of optimization ``` ## Usage Tips - Providing a complete table structure (including indexes) works even better - If you have EXPLAIN, provide the results as well - You can ask for optimization strategies for specific scenarios ## Applicable Models GPT-4、Claude 3.5、DeepSeek Coder
How to use this prompt
- 1Copy the complete prompt above.
- 2Replace the topic, subject, or style variables.
- 3Save effective changes to build your own version.



