log_planner_stats
Fact — official short description: “Writes planner performance statistics to the server log.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–19 Beta 3 | off |
— | off |
How it works
log_planner_stats emits planner-stage resource usage for every query using a crude getrusage-style profiler. Output goes to the server log and is intended for short diagnostic sessions.
log_statement_stats reports the total statement, while parser, planner, and executor switches report individual phases. The total switch cannot be enabled together with any per-phase switch.
This is synchronous diagnostic logging rather than the cumulative statistics system. Volume and formatting make it unsuitable as routine production telemetry. Its superuser context permits an authorized session change without a server restart.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Do not enable log_planner_stats as normal OLTP tuning. Use it briefly on an isolated reproduction or one controlled session, collect the needed log, then disable it. |
| OLAP | For a specific analytical statement, EXPLAIN (ANALYZE, BUFFERS) and cumulative views are usually more actionable than cluster-wide log_planner_stats. Scope any use and budget log volume. |
| Small nodes | Leave log_planner_stats=off. A small host is especially vulnerable to diagnostic log I/O and storage exhaustion. |
Pigsty
Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.
| Template | Effective value | Versus upstream boot | Source expression |
|---|---|---|---|
| OLTP | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.
Common pitfalls
- Enabling or enlarging log_planner_stats without measuring collection and observation overhead.
- Confusing collection semantics with a performance-control or I/O-control setting.
- Assuming all statistics are immediately current inside a long transaction.
- Collecting sensitive query text or identifiers without matching access and retention policy.
Related parameters
log_statement_stats · log_parser_stats · log_executor_stats · log_min_duration_statement · join_collapse_limit