slow_query_rca
Pinpoint the slowest PostgreSQL query and get cited causes plus concrete actions from pg_stat_statements metrics and optional EXPLAIN plans.
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| target | No | ||
| statements | No | ||
| explain_sql | No |