prompt

Slow Query Optimization

Speed up a slow database query.

Updated June 2026
The prompt
Help me optimize this slow SQL query: {{query}}. On a {{db}} database. Identify the likely reasons it is slow (missing indexes, full scans, inefficient joins, subqueries, functions on indexed columns, returning too much data), explain how to read what is happening, recommend specific improvements and indexes with the trade-offs, and provide an optimized version. Explain why each change helps, and note the change likely to give the biggest speedup. Keep correctness identical.
Did it work? Rate this prompt

Variables

SQL query
Database

Details

Author

AI Khazna

License

Security

Type

prompt

Related assets

More curated picks in Data & Analytics.

Audit before you install

Run any source through our checks - AI visibility, security, performance, and stack detection.

More in Data & Analytics