# stats_temp_directory

> stats_temp_directory — Writes temporary statistics files to the specified directory. Observed in PG9.0–14; its last measured boot default is pg_stat_tmp in PG14, with sighup context. It was removed in PG15.
---

> [!NOTE]
> **Fact — official short description:** “Writes temporary statistics files to the specified directory.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `string` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Statistics / Query and Index Statistics Collector | Upstream classification |
| Latest boot value | `pg_stat_tmp` | pg_stat_tmp |
{.fields meta="-"}

## Lifecycle {#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 {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.0–14 | `pg_stat_tmp` | — | pg_stat_tmp |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#tuning-advice}

> [!TIP]
> **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. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!CAUTION]
> **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 {#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 {#related-parameters}

[`stats_fetch_consistency`](/parameters/stats-fetch-consistency/) · [`track_counts`](/parameters/track-counts/) · [`track_activities`](/parameters/track-activities/) · [`data_directory`](/parameters/data-directory/)

## References {#references}

- [PostgreSQL 14 — stats_temp_directory](https://www.postgresql.org/docs/14/runtime-config-statistics.html#GUC-STATS-TEMP-DIRECTORY)
- [Machine-readable GUC export](/data/guc.jsonl)
