get_index_recommendations
Analyze PostgreSQL query workload to identify performance bottlenecks and generate optimized index recommendations that improve database query execution speed.
Instructions
Get AI-powered index recommendations for your database.
Analyzes your query workload (from pg_stat_statements) and recommends indexes that would improve performance. Uses a sophisticated analysis algorithm that:
Identifies slow queries and their access patterns
Extracts columns used in WHERE, JOIN, ORDER BY, and GROUP BY clauses
Generates candidate indexes (single-column and composite)
If HypoPG is available, tests indexes without creating them
Uses a greedy optimization algorithm to select the best index set
The recommendations consider:
Query frequency and total execution time
Estimated improvement from each index
Index size and maintenance overhead
Avoiding redundant indexes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workload_queries | No | Optional list of specific queries to analyze. If not provided, uses pg_stat_statements. | |
| max_recommendations | No | Maximum number of index recommendations to return | |
| min_improvement_percent | No | Minimum improvement percentage for a recommendation to be included | |
| include_hypothetical_testing | No | Whether to test indexes using HypoPG (if available) | |
| target_tables | No | Optional list of tables to focus on |