Investigate a Slow Database Query

Use Copilot to analyze and optimize slow SQL/Prisma queries.

category:database
performance
sql
workflow
multi-step
0

Prompt

A structured workflow for diagnosing slow queries using logs, EXPLAIN plans, and Copilot’s analysis.

## Steps:

1. Capture logs showing the slow behavior.

2. Paste the Prisma or SQL query.

3. Ask Copilot: "Explain what this query does and why it might be slow."

4. Ask Copilot to propose optimized indexes or query shapes.

5. Apply proposed improvements.

6. Paste the EXPLAIN output.

7. Ask Copilot: "Interpret this EXPLAIN plan."

8. Re-run performance tests.