# fsync

> Flush WAL and data changes to disk before a commit reports success.

Source: https://sqlly.app/sql-configuration/postgresql/fsync
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**

`on`

**Range**

on, off

**Restart needed**

No

**Default checked on**

PostgreSQL 18

## What it does

The master switch for durability. With it off, the server hands writes to the OS and acknowledges commits without waiting for the disk; a crash can then lose or tear data. synchronous_commit = off buys much of the same speed without the corruption risk.

## Default value

`on`. on (PostgreSQL 18).

## Check the current value

```
SHOW fsync;

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

## Change it

```
ALTER SYSTEM SET fsync = off;
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

Almost never in production. The legitimate cases are throwaway load tests and an initial bulk load into a cluster you will back up or rebuild before serving traffic.

## What can go wrong

Off leaves acknowledged commits in the OS page cache, so a crash, power loss or disk error can corrupt the cluster beyond repair; docs advise considering full_page_writes = off alongside, which removes torn-page protection on top. Turning it back on does not undo damage taken while it was off.

## Questions about fsync

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

on. on (PostgreSQL 18).

### Does changing fsync 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 fsync?

Almost never in production. The legitimate cases are throwaway load tests and an initial bulk load into a cluster you will back up or rebuild before serving traffic.

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

- [`synchronous_commit` Whether COMMIT waits for its WAL to reach disk (and standbys) before reporting success.](https://sqlly.app/sql-configuration/postgresql/synchronous-commit)
- [`full_page_writes` Write a full copy of each page to WAL the first time it changes after a checkpoint.](https://sqlly.app/sql-configuration/postgresql/full-page-writes)
- [`wal_compression` Compress full-page images written to the WAL.](https://sqlly.app/sql-configuration/postgresql/wal-compression)
