Skip to main content
Glama

PostgreSQL-Performance-Tuner-Mcp

get_slow_queries

Identify and analyze slow PostgreSQL queries using pg_stat_statements to optimize database performance by revealing execution times, call frequency, and cache efficiency metrics.

Instructions

Retrieve slow queries from PostgreSQL using pg_stat_statements.

Returns the top N slowest queries ordered by total execution time. Requires the pg_stat_statements extension to be enabled.

The results include:

  • Query text (normalized)

  • Total execution time

  • Number of calls

  • Mean execution time

  • Rows returned

  • Shared buffer hits/reads for cache analysis

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of slow queries to return (default: 10)
min_callsNoMinimum number of calls for a query to be included (default: 1)
min_total_time_msNoMinimum total execution time in milliseconds (default: 0)
order_byNoColumn to order results bytotal_time

Input Schema (JSON Schema)

{ "properties": { "limit": { "default": 10, "description": "Maximum number of slow queries to return (default: 10)", "maximum": 100, "minimum": 1, "type": "integer" }, "min_calls": { "default": 1, "description": "Minimum number of calls for a query to be included (default: 1)", "minimum": 1, "type": "integer" }, "min_total_time_ms": { "default": 0, "description": "Minimum total execution time in milliseconds (default: 0)", "type": "number" }, "order_by": { "default": "total_time", "description": "Column to order results by", "enum": [ "total_time", "mean_time", "calls", "rows" ], "type": "string" } }, "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