stats_temp_directory
Fact — official short description: “Writes temporary statistics files to the specified directory.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–14 |
| Removed in | PG15 |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–14 | pg_stat_tmp |
— | pg_stat_tmp |
How it works
Through PG14, stats_temp_directory selected where the old statistics collector wrote temporary statistics files. It did not store durable table statistics created by ANALYZE.
A fast local memory-backed directory could reduce collector file I/O, but loss of its temporary contents was expected. Permissions and directory availability still had to permit the server to operate.
PostgreSQL 15 replaced the collector’s file-based architecture with shared-memory cumulative statistics and removed this GUC. PG15+ migrations must delete the setting rather than map it to another directory. Its SIGHUP context allows configuration reload without a server restart.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Do not tune stats_temp_directory on current PostgreSQL: remove it from upgrade targets and use the current replacement behavior described above. Retain it only when reproducing the historical version. |
| OLAP | Do not carry stats_temp_directory into a modern analytical cluster. Benchmark the supported current mechanisms instead of trying to emulate a removed implementation detail. |
| Small nodes | Delete stats_temp_directory during version migration; an unknown-parameter startup failure is more likely than a benefit. Historical test instances should keep the old upstream default. |
Pigsty
Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG14; 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–14 unmodified; OLAP: PG9.0–14 unmodified; CRIT: PG9.0–14 unmodified; TINY: PG9.0–14 unmodified. No Pigsty-specific rationale is inferred from an absent override.
Common pitfalls
- Changing stats_temp_directory without applying its documented unit and configuration context.
- Optimizing an isolated benchmark while ignoring concurrent aggregate resource use.
- Assuming a configured value guarantees operating-system or storage behavior.
- Failing to retest startup, failover, and workload latency after the change.
Related parameters
stats_fetch_consistency · track_counts · track_activities · data_directory