Parameter · Developer Options
debug_io_direct
Use direct I/O for file access. An empty string disables direct I/O.
- Default:
'' (empty) - Type: string
- Applies: Restart required
In plain words
PostgreSQL normally reads and writes through the operating system's file cache. This setting asks the OS to skip that cache for data files, WAL, or both. It exists so developers can test the direct I/O code paths; it makes PostgreSQL slower today, because the server still relies on the OS cache and read-ahead.
For DBAs and operators
Accepted values: an empty string (off), or a list of data, wal, wal_init. Set at server start. Uses O_DIRECT on most Unix-like systems, F_NOCACHE on macOS and FILE_FLAG_NO_BUFFERING on Windows; some operating systems and filesystems do not support direct I/O, so a non-default value may be rejected at startup or cause errors. The value is refused if the data or WAL block size is smaller than the 4 kB I/O alignment (the default 8 kB sizes are fine).
Added in PostgreSQL 16 as groundwork. In 18, the new asynchronous I/O subsystem (io_method) is the first step toward making direct I/O useful, but with shared_buffers at typical sizes you lose the OS cache as a second-level cache and read-ahead. The debug_ prefix is the project telling you not to use it in production.
Developer option: meant for debugging and testing PostgreSQL itself. Leave it at the default on production servers unless a specific diagnosis calls for it.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.
See it in context
Related parameters
io_method shared_buffers wal_sync_method effective_io_concurrency