Skip to main content
Glama

PostgreSQL-Performance-Tuner-Mcp

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:

  1. Identifies slow queries and their access patterns

  2. Extracts columns used in WHERE, JOIN, ORDER BY, and GROUP BY clauses

  3. Generates candidate indexes (single-column and composite)

  4. If HypoPG is available, tests indexes without creating them

  5. 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

NameRequiredDescriptionDefault
workload_queriesNoOptional list of specific queries to analyze. If not provided, uses pg_stat_statements.
max_recommendationsNoMaximum number of index recommendations to return
min_improvement_percentNoMinimum improvement percentage for a recommendation to be included
include_hypothetical_testingNoWhether to test indexes using HypoPG (if available)
target_tablesNoOptional list of tables to focus on

Input Schema (JSON Schema)

{ "properties": { "include_hypothetical_testing": { "default": true, "description": "Whether to test indexes using HypoPG (if available)", "type": "boolean" }, "max_recommendations": { "default": 10, "description": "Maximum number of index recommendations to return", "maximum": 50, "minimum": 1, "type": "integer" }, "min_improvement_percent": { "default": 10, "description": "Minimum improvement percentage for a recommendation to be included", "type": "number" }, "target_tables": { "description": "Optional list of tables to focus on", "items": { "type": "string" }, "type": "array" }, "workload_queries": { "description": "Optional list of specific queries to analyze. If not provided, uses pg_stat_statements.", "items": { "type": "string" }, "type": "array" } }, "required": [], "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/isdaniel/pgtuner-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server