DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Resource Usage / Disk

file_extend_method

Selects the method used for extending data files.

  • Default: posix_fallocate
  • Type: enum
  • Values: posix_fallocate · write_zeros
  • Applies: Reload

In plain words

When a bulk operation such as COPY needs more space, PostgreSQL extends the table file by several blocks at once. It can ask the filesystem to reserve the space (posix_fallocate) or literally write blocks of zeros (write_zeros).

For DBAs and operators

Added in minor releases 18.2, 17.8 and 16.12 (not in 18.0/18.1). Since PostgreSQL 16, bulk relation extension adds many blocks at once; extensions larger than 8 blocks use the configured method, smaller ones always write zeros. posix_fallocate is the default where available and silently falls back to writing zeros if the filesystem does not support it.

The known reason to switch: on Btrfs, fallocate disables compression for the affected file ranges, so heavily compressed Btrfs volumes grow unexpectedly. write_zeros avoids that at the cost of more write I/O during bulk loads. The other reported case is spurious out-of-space errors on XFS with older Linux kernels. Otherwise keep the default. A reload is enough to change it.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Physical layout on disk Page layout

Related parameters

file_copy_method

All Resource Usage parameters