select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / STATISTICS

stats_temp_directory

Read PG 14 manual ↗

Sets the directory to store temporary statistics data in.

Type
string
Context
sighup
Measured default
pg_stat_tmp
Unit
Metadata snapshot
14

Definition PG 14 manual

Sets the directory to store temporary statistics data in. This can be a path relative to the data directory or an absolute path. The default is pg_stat_tmp. Pointing this at a RAM-based file system will decrease physical I/O requirements and can lead to improved performance. This parameter can only be set in the postgresql.conf file or on the server command line.

Measured default history
Version intervalDefault
9.0 – 14pg_stat_tmp
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

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.

Operational considerations

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.

Workload guidance

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.

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.

SMALL: 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.

Version history 1
  1. PG 14 → 15removed

Related entries

Further reading

Definition snapshot: english-manuals:96a282817d297641ff112b7b444… · English manual source