Configuration parameter

file_extend_method — PostgreSQL configuration parameter

Category Resource Consumption

Specifies the method used to extend data files during bulk operations such as COPY.

At a glance

Property Value
Parameter file_extend_method
Category Resource Consumption
Default (see documentation)
Value type enum
Change scope Per-session (SET)
Available in PostgreSQL 16, 17, 18, 19 (added in 16)

What it does

Specifies the method used to extend data files during bulk operations such as COPY. The first available option is used as the default, depending on the operating system: posix_fallocate (Unix) uses the standard POSIX interface for allocating disk space, but is missing on some systems. If it is present but the underlying file system doesn’t support it, this option silently falls back to write_zeros. Current versions of BTRFS are known to disable compression when this option is used. This is the default on systems that have the function.

write_zeros extends files by writing out blocks of zero bytes. This is the default on systems that don’t have the function posix_fallocate.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW file_extend_method; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'file_extend_method';.

Tuning guidance

This parameter is rarely a performance lever. Leave it at the default unless you have a specific, documented reason to change it, change it on one session or one role/database first, and confirm the effect with pg_settings and your own measurements before rolling it out cluster-wide.

Reference

PostgreSQL documentation — file_extend_method.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters