# bgwriter_delay

> Time between rounds of the background writer, which cleans buffers ahead of other sessions.

Source: https://sqlly.app/sql-configuration/postgresql/bgwriter-delay
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**Default**

`200ms`

**Range**

1ms to 10s

**Restart needed**

No

**Default checked on**

PostgreSQL 18

## What it does

Each round the background writer writes dirty buffers picked from behind the clock-sweep hand, then sleeps this long; when it finds nothing dirty it sleeps longer regardless. bgwriter_lru_maxpages bounds what it writes per round.

## Default value

`200ms`. 200ms (PostgreSQL 18).

## Check the current value

```
SHOW bgwriter_delay;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'bgwriter_delay';
```

## Change it

```
ALTER SYSTEM SET bgwriter_delay = '500ms';
SELECT pg_reload_conf();
```

No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

## When to change it

Rarely. Compare buffers_backend with buffers_clean in pg_stat_bgwriter: when backends write most buffers themselves, a shorter delay or larger bgwriter_lru_maxpages shifts some of that work off the query path.

## What can go wrong

Too short burns CPU on rounds that find little to write; too long leaves backends writing their own buffers and adds latency to their queries. It is not the checkpoint writer: checkpoints flush their own bulk, so this cannot fix checkpoint I/O spikes.

## Questions about bgwriter_delay

### What is the default value of bgwriter_delay in PostgreSQL?

200ms. 200ms (PostgreSQL 18).

### Does changing bgwriter_delay require a restart?

No. No restart: reload with SELECT pg_reload_conf() or pg_ctl reload. It cannot be changed per session (context is sighup).

### When should I change bgwriter_delay?

Rarely. Compare buffers_backend with buffers_clean in pg_stat_bgwriter: when backends write most buffers themselves, a shorter delay or larger bgwriter_lru_maxpages shifts some of that work off the query path.

Back to all [PostgreSQL settings](https://sqlly.app/sql-configuration/postgresql), or check the [PostgreSQL manual](https://www.postgresql.org/docs/current/runtime-config.html) for every option.

## Related PostgreSQL settings

- [`shared_buffers` Size of PostgreSQL's own page cache, shared by all sessions.](https://sqlly.app/sql-configuration/postgresql/shared-buffers)
- [`checkpoint_completion_target` Fraction of the checkpoint interval over which the checkpoint's writes are spread.](https://sqlly.app/sql-configuration/postgresql/checkpoint-completion-target)
- [`max_wal_size` WAL volume that triggers a checkpoint before checkpoint_timeout is reached.](https://sqlly.app/sql-configuration/postgresql/max-wal-size)
