← Back to Skills

Database Index Advisor

Analyze slow queries, recommend indexes, and generate migration scripts

Data 5 steps 4 tools 4 servers

Example Prompt

Find our slowest database queries, recommend indexes, and generate the migration scripts

About

Examines the database's slow query log and execution plans to identify queries that would benefit from indexing. Recommends optimal index strategies based on query patterns and table statistics, then generates ready-to-use migration scripts for the proposed indexes.

Workflow Steps

1

Query the PostgreSQL slow query log and pg_stat_statements for underperforming queries

📊 Run SQL Query
2

Run EXPLAIN ANALYZE on the slowest queries to examine execution plans

📊 Run SQL Query
3

Analyze execution plans and recommend optimal indexes based on query patterns

🧠 Structured Reasoning
4

Generate SQL migration scripts for the recommended indexes

✏️ Write File
5

Post the index recommendations and expected performance improvements to Slack

📨 Send Message

Tags

databaseindexingperformancemigrations