Skip to content

vacuum_truncate

vacuum_truncate — Enables vacuum to truncate empty pages at the end of the table. Observed in PG18–19 Beta 3; its last measured boot default is on in PG19 Beta 3, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Enables vacuum to truncate empty pages at the end of the table.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valueuser
Settable by an ordinary user
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueVacuuming / Default Behavior
Upstream classification
Latest boot value , Valueon
on

Lifecycle

Fact Value
First observed PG18
Present in PG18–19 Beta 3
Removed in No
Introduction commit 0164a0f9ee12 — Add vacuum_truncate configuration parameter.
Commit date 2025-03-20
Discussion thread 1

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG18–19 Beta 3 on on

How it works

Enables vacuum to truncate empty pages at the end of the table. It can be changed at session scope, so different sessions may observe different behavior.

At the end of VACUUM, PostgreSQL may take an ACCESS EXCLUSIVE lock and remove wholly empty pages from the physical tail of a table. Disabling truncation avoids that lock episode but leaves the file allocated for later reuse.

Monitor and change vacuum_truncate together with vacuum_max_eager_freeze_failure_rate, vacuum_freeze_table_age, autovacuum_freeze_max_age. Validate on the relevant server role and real workload, then use its user context to choose session change, reload, or restart; a historical boot default is not the current effective value.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Tune vacuum_truncate from table size, change rate, and maintenance SLA, using per-table thresholds for large/hot relations. Observe trigger intervals, dead tuples, and ANALYZE/VACUUM duration.
OLAP Run explicit ANALYZE/VACUUM after bulk loads instead of waiting only for proportional triggers; plan freezing and visibility-map advancement separately for append-only partitions.
Small nodes Start with upstream or the measured Pigsty matrix value. Fixed thresholds dominate on small tables; after changes, confirm worker and I/O headroom.

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
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG18–19 Beta 3 unmodified; OLAP: PG18–19 Beta 3 unmodified; CRIT: PG18–19 Beta 3 unmodified; TINY: PG18–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Assuming truncation removes empty pages in the middle of a relation; only a contiguous empty tail can be removed.
  • Ignoring the ACCESS EXCLUSIVE lock attempt and blocking latency on a busy table.
  • Disabling truncation and expecting the operating system file size to shrink anyway.
  • Forgetting a table-level vacuum_truncate storage parameter can override the session/global value.
  • Relying on truncation during wraparound failsafe, when VACUUM can skip it to finish sooner.

vacuum_max_eager_freeze_failure_rate · vacuum_freeze_table_age · autovacuum_freeze_max_age · maintenance_work_mem · autovacuum · autovacuum_analyze_scale_factor

References