SYNTHESE
NewsToolsPromptsAboutNewsletterJoin Us

AI Tools

All ToolsImage & DesignVideo & AnimationAudio & VoiceWriting & CopyCode & DevelopmentSearch & ResearchProductivity & WorkflowsEducation & LearningAgents & Assistants

Prompts

All PromptsWriting & CopyProductivity & WorkflowsCode & DevelopmentVisual & Image GenerationData & AnalyticsProduct & App DevelopmentCreative & PhotographyMarketing & SEOLearning & Education
← News Feed

SYNTHESE

AI Content & Tools Community

NewsToolsNewsletterAbout
© 2026 SYNTHESE. All rights reserved.
Privacy PolicyTerms of Service
← Back to Prompts
Code & Development

SQL Query Optimizer

Diagnose and rewrite slow SQL queries with expert-level explanations.

Use case

Analyzing and optimizing SQL queries for better performance

Works best with

ClaudeChatGPT

Input needed

The SQL query, table schemas (with indexes), approximate row counts, and the database engine (PostgreSQL, MySQL, etc.)

Output format

Optimized query, explanation of changes, index recommendations, and estimated performance impact

Example use

Paste a slow JOIN query across 3 tables. Get back an optimized version using proper indexing, query restructuring, and an EXPLAIN plan analysis showing why the original was slow.

Editor’s Note

Highly reliable for common optimization patterns (missing indexes, N+1 queries, subquery-to-JOIN rewrites). Less reliable for database-specific edge cases and optimizer hints. Always test with EXPLAIN ANALYZE on your actual data — row estimates and cardinality matter.

Full Prompt

Act as a senior database administrator and SQL performance expert. Analyze and optimize the following SQL query.

```sql
[PASTE QUERY HERE]
```

Database: [PostgreSQL / MySQL / SQLite / other]
Table sizes (approximate): [e.g., users: 2M rows, orders: 10M rows]

Provide:
1. Diagnosis — Explain what is causing the slowness (full table scan, missing index, N+1, etc.).
2. Optimized Query — Rewrite the query for maximum performance.
3. Indexes to Create — Exact CREATE INDEX statements to add.
4. Explanation — Why each change improves performance.

Tags

sqldatabaseperformanceoptimization

More Code & Development Prompts

Bug Reproduction and Root Cause Report

Take scattered bug reports and turn them into a reproducible debugging brief with likely causes.

GitHub Issue to Implementation Plan

Convert a raw issue into a scoped execution plan with risks, dependencies, and validation steps.

API Endpoint Designer

Design a complete REST API endpoint spec with request/response schemas.

Code Review & Refactor

Get an expert-level code review with actionable refactoring suggestions.