fsync is required to persist data to disk:
the WAL (transaction log), so that committed transactions are on disk and no data modification takes place before it is logged in WAL
the data files during a checkpoint
Both WAL and checkpoints are cluster-wide concepts, so your whole cluster will be broken after a crash with fsync disabled.
Don't touch that dial!
Answer from Laurenz Albe on Stack OverflowPostgreSQL
postgresqlco.nf › en › doc › param › fsync
PostgreSQL Documentation: fsync parameter
fsync: Default: on, Context: sighup, Needs restart: false • Forces synchronization of updates to disk.
Does turning off fsync in PostgreSQL can corrupt all the database or only the specific table I'm working with - Stack Overflow
I'm working with PostgreSQL and I read a lot about the unrecommended option of disabling fsync (fsync = off). More on stackoverflow.com
Difference between fsync and synchronous_commit - postgresql - Database Administrators Stack Exchange
When fsync is OFF, the PostgreSQL server will never issue any fsync system call, leaving entirely to the operating system the decision as to which blocks to transfer from write cache to disk, and when. The database engine never knows what has been sync'ed or not. More on dba.stackexchange.com
PostgreSQL's fsync() surprise
Why would open() followed by fsync() in one process be expected to show errors that were encountered in another process that had written the same file? More on reddit.com
If I turn off fsync, full_page_writes, and synchronous_commit but set up replication to backup to a standby server, will I still see a performance gain?
The first thing I'd check is whether turning off fsync and full page writes actually makes a real difference to performance even without replication. Turning synchronous_commit off is something I would do without hesitation and can provide a huge speed boost to the latency of write operations. But with that disabled the other two settings mostly just affect the behaviour of background processes. More on reddit.com
Videos
Hacker News
news.ycombinator.com › item
PostgreSQL used fsync incorrectly for 20 years | Hacker News
February 14, 2019 - I patched my own systems (wrap the calls in a loop as per standard practice) and then proceeded to run literally hundreds of thousands of PostgreSQL instances on NFS for many more years with no problems · The patch was eventually integrated it seems but I never found out why because I lost ...
PostgreSQL Wiki
wiki.postgresql.org › wiki › Fsync_Errors
Fsync Errors - PostgreSQL wiki
July 5, 2023 - It has sometimes been referred to as "fsyncgate 2018". ... As of this PostgreSQL 12 commit, PostgreSQL will now PANIC on fsync() failure. It was backpatched to PostgreSQL 11, 10, 9.6, 9.5 and 9.4.
PostgreSQL
postgresql.org › docs › current › pgtestfsync.html
PostgreSQL: Documentation: 18: pg_test_fsync
November 13, 2025 - November 13, 2025: PostgreSQL 18.1, 17.7, 16.11, 15.15, 14.20, and 13.23 Released! ... pg_test_fsync is intended to give you a reasonable idea of what the fastest wal_sync_method is on your specific system, as well as supplying diagnostic information in the event of an identified I/O problem.
EnterpriseDB
enterprisedb.com › blog › dont-set-fsyncoff-if-you-want-keep-your-data
Don't set fsync=off if you want to keep your data | EDB
If you are ever tempted to set fsync=off, pretend it’s called eat_my_data_if_you_feel_like_it=on and see if you still want to set it. synchronous_commit=off is probably a better choice. Read the manual. ... This blog was co-authored by Craig Ringer and Xavier Fischer. This is an updated version of Craig Ringer's Compiling PostgreSQL extensions with Visual Studio on Windows blog post, with Visual...
LWN.net
lwn.net › Articles › 752063
PostgreSQL's fsync() surprise [LWN.net]
April 18, 2018 - Craig Ringer first reported the problem to the pgsql-hackers mailing list at the end of March. In short, PostgreSQL assumes that a successful call to fsync() indicates that all data written since the last successful call made it safely to persistent storage. But that is not what the kernel actually does.
Percona
percona.com › home › postgresql fsync failure fixed – minor versions released feb 14, 2019
PostgreSQL fsync Failure Fixed – Minor Versions Released Feb 14, 2019
February 10, 2024 - This means, almost all the time in your production database server, you’ll see PostgreSQL using O_SYNC / O_DSYNC while writing to WAL’s. Whereas, writing the modified/dirty buffers to datafiles from shared buffers is always through Buffered IO. Let’s understand this further. Upon checkpoint, dirty buffers in shared buffers are written to the page cache managed by kernel. Through an fsync(), these modified blocks are applied to disk.
Reddit
reddit.com › r/programming › postgresql's fsync() surprise
r/programming on Reddit: PostgreSQL's fsync() surprise
April 24, 2018 - That's exactly the case. Pretty sure the title is simply because it was the Postgres team that reported the bug. ... As far as I understand fsync will tell you if your writes failed unless you call it on a new file descriptor created after the fact. PostgreSQL just assumed that this would work.
FOSDEM
archive.fosdem.org › 2019 › schedule › event › postgresql_fsync
FOSDEM 2019 - PostgreSQL vs. fsync
I'll walk you through fsync basics, explain how we always thought/assumed it works and how it actually behaves. I'll also discuss where the misunderstanding likely comes from - which is a mix of cultural and technical reasons rooted in the past. We'll see how this issue impacts current PostgreSQL deployments, what you can (and can't) do about it, and finally outline some plans for addressing it properly in the future.
Reddit
reddit.com › r/postgresql › if i turn off fsync, full_page_writes, and synchronous_commit but set up replication to backup to a standby server, will i still see a performance gain?
r/PostgreSQL on Reddit: If I turn off fsync, full_page_writes, and synchronous_commit but set up replication to backup to a standby server, will I still see a performance gain?
January 9, 2023 -
I'm just trying to see if I can get additional performance risking the integrity of my primary cluster by using replication to back up after the fact (presumably after high-load transactions have completed) instead of using the WAL.
Do I need to set max_standby_streaming_delay or similar parameters to do this correctly?
Are there any measurements out there for what I should expect from this?
Top answer 1 of 2
7
The first thing I'd check is whether turning off fsync and full page writes actually makes a real difference to performance even without replication. Turning synchronous_commit off is something I would do without hesitation and can provide a huge speed boost to the latency of write operations. But with that disabled the other two settings mostly just affect the behaviour of background processes.
2 of 2
3
Another option is, instead of replication use wal archiving with pgbackrest and a spool_dir for async archiving.
Tanelpoder
tanelpoder.com › posts › using-pg-test-fsync-for-testing-low-latency-writes
Using Postgres pg_test_fsync tool for testing low latency writes | Tanel Poder Blog
May 27, 2025 - The pg_test_fsync tool is bundled with standard Postgres packages, so no extra installation is needed. You don’t actually have to use Postgres as your database, this tool’s output is universally valuable for any workload requiring fast writes. - Linux, Oracle, SQL performance tuning and ...
DBI Services
dbi-services.com › accueil › postgres, the fsync() issue, and ‘pgio’ (the slob method for postgresql)
Postgres, the fsync() issue, and 'pgio' (the SLOB method for PostgreSQL)
May 24, 2018 - Postgres, from the beginning, relies a lot on the filesystem buffering to optimize I/O. So they write() to the data files but fsync() only at checkpoints.
YouTube
youtube.com › watch
Your SSD lies but that's ok .. I think | Postgres fsync - YouTube
fsync is a linux system call that flushes all pages and metadata for a given file to the disk. It is indeed an expensive operation but required for durabilit...
Published May 25, 2023