Top queries
pg_top_queriesRank PostgreSQL queries from pg_stat_statements by calls, total or mean time, rows, blocks, temp files, or WAL to identify slow and expensive statements for tuning.
Instructions
Rank the queries of the current database from pg_stat_statements: calls, total and mean time, rows, share of the total time, blocks read and hit, temporary file volume, WAL generated and planning time (WAL and planning on PostgreSQL 13+).
Use it to find what is slow or expensive. order_by is one of total_time, mean_time,
calls, rows, shared_blks_read, temp_blks_written or wal_bytes. min_calls ignores
statements that ran fewer times. Needs the pg_stat_statements extension. The query text is
normalized (constants replaced by $n) and cut; pass it to pg_explain to see the plan.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "pg_top_queries"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| order_by | No | total_time | |
| min_calls | No | ||
| connection | No |