Ask the kernel to minimize caching effects for relation data and WAL files using O_DIRECT (most Unix-like systems), F_NOCACHE (macOS) or FILE_FLAG_NO_BUFFERING (Windows).
At a glance
| Property | Value |
|---|---|
| Parameter | debug_io_direct |
| Category | Developer Options |
| Default | (see documentation) |
| Value type | string |
| Change scope | Server restart required (postgresql.conf) |
| Available in | PostgreSQL 16, 17, 18, 19 (added in 16) |
What it does
Ask the kernel to minimize caching effects for relation data and WAL files using O_DIRECT (most Unix-like systems), F_NOCACHE (macOS) or FILE_FLAG_NO_BUFFERING (Windows).
May be set to an empty string (the default) to disable use of direct I/O, or a comma-separated list of operations that should use direct I/O. The valid options are data for main data files, wal for WAL files, and wal_init for WAL files when being initially allocated. This parameter can only be set at server start.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Set it in postgresql.conf (or with ALTER SYSTEM) and restart the server — this parameter cannot change without a restart.
Inspect the current value and source with SHOW debug_io_direct; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'debug_io_direct';.
Tuning guidance
This is a developer and debugging aid, not a performance knob. Leave it at the default in production; enable it only temporarily, on a non-production or carefully controlled system, while diagnosing a specific problem. Several options in this group add overhead, generate large volumes of log output, or can damage data if misused — turn them off again as soon as the investigation is done.