debug_io_direct
Fact — official short description: “Use direct I/O for file access.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG16 |
| Present in | PG16–19 Beta 3 |
| Removed in | No |
| Introduction commit | 319bae9a8da6 — Rename io_direct to debug_io_direct. |
| Commit date | 2023-05-15 |
| Discussion | thread 1 |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG16–19 Beta 3 | "" |
— | empty string |
How it works
debug_io_direct requests cache-bypassing file access for selected operations: data, wal, and wal_init. PostgreSQL maps this to O_DIRECT, F_NOCACHE, or FILE_FLAG_NO_BUFFERING according to platform.
The empty string disables direct I/O. Unsupported kernels or file systems can reject startup or fail operations, and alignment constraints differ across platforms.
PostgreSQL documentation explicitly describes current nondefault use as performance-reducing developer testing. It is distinct from the PG18 asynchronous-I/O method and should not be presented as a production cache policy. Its postmaster context fixes the value at server start; changing it requires a restart.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Do not tune production OLTP with debug_io_direct. Enable it only for a bounded reproduction with an owner, log/disk budget, rollback condition, and evidence-capture plan; restore the default immediately afterward. |
| OLAP | Long analytical runs can amplify debug_io_direct’s debug overhead and artifacts. Prefer standard EXPLAIN and statistics first, and isolate any developer experiment from normal users. |
| Small nodes | Keep debug_io_direct at its upstream default. A small host has less spare CPU, disk, connection, and log capacity for developer instrumentation. |
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 | — | — |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG16–19 Beta 3 unmodified; OLAP: PG16–19 Beta 3 unmodified; CRIT: PG16–19 Beta 3 unmodified; TINY: PG16–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.
Common pitfalls
- Leaving debug_io_direct enabled after the bounded diagnostic or recovery task.
- Running the experiment on the only copy of production data.
- Underestimating log, core-file, temporary-file, WAL, CPU, or connection-slot amplification.
- Treating a server that merely starts or completes a query as proof that data and behavior are correct.
Related parameters
io_method · io_max_concurrency · wal_sync_method · shared_buffers · backend_flush_after