Skip to main content
Glama
call518

MCP PostgreSQL Operations

get_pg_stat_statements_top_queries

Analyze top PostgreSQL queries by execution time to identify performance bottlenecks and optimize database performance using pg_stat_statements statistics.

Instructions

[Tool Purpose]: Analyze top queries that consumed the most time using pg_stat_statements extension

[Exact Functionality]:

  • Retrieve top query list based on total execution time

  • Display call count, average execution time, and cache hit rate for each query

  • Support identification of queries requiring performance optimization

[Required Use Cases]:

  • When user requests "slow queries", "performance analysis", "top queries", etc.

  • When database performance optimization is needed

  • When query performance monitoring or tuning is required

[Strictly Prohibited Use Cases]:

  • When pg_stat_statements extension is not installed

  • Requests for query execution or data modification

  • Requests for statistics data reset or configuration changes

Args: limit: Number of top queries to retrieve (default: 20, max: 100) database_name: Database name to analyze (uses default database if omitted)

Returns: Performance statistics including query text, call count, total execution time, average execution time, and cache hit rate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
database_nameNo

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/call518/MCP-PostgreSQL-Ops'

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