slow_query_rca
Diagnose root cause and actions for the top pg_stat_statements entry by total execution time. Pass statements for offline analysis or omit to pull live.
Instructions
[READ] RCA for the worst pg_stat_statements entry, with cause + action.
Picks the statement with the greatest total execution time and maps its
numbers (mean time, cache-hit ratio, temp spill, calls) — plus an optional
EXPLAIN plan — to cited causes and concrete actions. Pass 'statements' for
pure/offline analysis, or omit to pull the top statements live.
Args:
statements: Injected pg_stat_statements rows (as from top_queries); if
omitted, the worst statements are pulled live.
explain_sql: Optional SQL to EXPLAIN so plan node types feed the RCA.
limit: How many statements to pull when not injected (default 20).
target: Target name from config; omit for the default.
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": "slow_query_rca"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| target | No | ||
| statements | No | ||
| explain_sql | No |