# debug_io_direct

> debug_io_direct — Use direct I/O for file access. Observed in PG16–19 Beta 3; its last measured boot default is empty string in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Use direct I/O for file access.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `string` | Upstream pg_settings type |
| Context | `postmaster` | Requires a server restart |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Developer Options | Upstream classification |
| Latest boot value | `""` | empty string |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG16 |
| Present in | PG16–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`319bae9a8da6`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=319bae9a8da66678d80d862440e54cebc7b1cc24) — Rename io_direct to debug_io_direct. |
| Commit date | 2023-05-15 |
| Discussion | [thread 1](https://postgr.es/m/20230430041106.GA2268796%40rfd.leadboat.com) |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG16–19 Beta 3 | `""` | — | empty string |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#tuning-advice}

> [!TIP]
> **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. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!CAUTION]
> **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 {#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 {#related-parameters}

[`io_method`](/parameters/io-method/) · [`io_max_concurrency`](/parameters/io-max-concurrency/) · [`wal_sync_method`](/parameters/wal-sync-method/) · [`shared_buffers`](/parameters/shared-buffers/) · [`backend_flush_after`](/parameters/backend-flush-after/)

## References {#references}

- [PostgreSQL 19 Beta 3 — debug_io_direct](https://www.postgresql.org/docs/19/runtime-config-developer.html#GUC-DEBUG-IO-DIRECT)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
