Skip to main content
Glama
isdaniel

PostgreSQL-Performance-Tuner-Mcp

get_slow_queries

Identify and analyze slow PostgreSQL queries using pg_stat_statements to optimize database performance by revealing top time-consuming queries with execution 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.

Note: This tool focuses on user/application queries only. System catalog queries (pg_catalog, information_schema, pg_toast) are automatically excluded.

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

TableJSON 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

Latest Blog Posts

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