polar_stat_sql
polar_stat_sql · Collect per-query kernel, plan-node, and wait statistics in PolarDB PostgreSQL 11
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102007 | polar_stat_sql | polar_stat_sql | 1.3 | STAT | Apache-2.0 | C |
PostgreSQL · 11
| Relationships | |
|---|---|
| Requires | pg_stat_statements |
Usage
Sources:
polar_stat_sql 1.3 collects per-query kernel resource use, plan-node activity, execution phases, lock waits, and storage I/O in the official PolarDB PostgreSQL 11 branch. Its implementation uses PolarDB-specific instrumentation; this is not a stock PostgreSQL compatibility claim.
Enablement and Core Workflow
On the matching PolarDB build, preload the dependency first, append both modules to the existing list, and restart:
The preload order matters: initialization reads the pg_stat_statements.max setting. The SQL view joins the extension’s counters with statement text, database names, and role names. polar_stat_sql() exposes raw identifiers and counters; polar_stat_sql_reset() clears its statistics and has public execution revoked by the installation SQL.
Configuration and Limits
polar_stat_sql.sample_rate controls sampling. polar_stat_sql.enable_getrusage enables kernel resource measurements; polar_stat_sql.enable_gather_plan_info and polar_stat_sql.enable_plan_need_time control plan-node details and timing. polar_stat_sql.save controls persistence across shutdowns. Enabling extra measurements adds work to query execution, so choose the required detail deliberately.
Installation and preload changes require administrative access. The collector uses shared state and platform-dependent kernel counters; treat results as monitoring data, not an audit trail. The canonical source and versioned SQL are present in POLARDB_11_STABLE; this module was not found in the currently inspected official 15 and 17 branches. Do not assume that a newer PolarDB or PostgreSQL server provides it.