PG_TEST_FSYNC(1)
π¦ pg_test_fsync β bestie edition π¦
okay so this is the pg_test_fsync(1) page from the PostgreSQL 13.23 docs, and it's genuinely one of those little tools that's lowkey more useful than it looks π
β¨ NAME β¨
pg_test_fsync β the tool that figures out the fastest wal_sync_method for your PostgreSQL setup π
πΈ SYNOPSIS πΈ
pg_test_fsync [option...]
π DESCRIPTION π
so pg_test_fsync is here to give you a reasonable idea of what the fastest wal_sync_method is on your specific system, and it also hands you diagnostic info in case you've got an identified I/O problem going on π«Ά
but real talk β the differences it shows you might not make any significant difference in actual database throughput, especially since like, a lot of database servers are not speed-limited by their write-ahead logs. so don't spiral, okay? π
what it does report is the average file sync operation time in microseconds for each wal_sync_method β¨ and that number is also genuinely useful if you're trying to optimize the value of commit_delay. iykyk π
π OPTIONS π
pg_test_fsync accepts the following command-line options, bestie:
-f,--filenameβ specifies the file name to write test data in. this file should live in the same file system that thepg_waldirectory is (or will be) placed in. (pg_walis where the WAL files hang out, in case you were wondering π§) the default ispg_test_fsync.outin the current directory.-s,--secs-per-testβ specifies the number of seconds for each test. more time per test = greater accuracy, but also the longer it takes to run. the default is 5 seconds, which lets the program finish in under 2 minutes β-V,--versionβ print thepg_test_fsyncversion and exit. simple, iconic.-?,--helpβ show help aboutpg_test_fsynccommand line arguments, and exit. your little safety net π
π ENVIRONMENT π
the environment variable PG_COLOR specifies whether to use color in diagnostic messages π the possible values are always, auto and never.
π₯ SEE ALSO π₯
postgres(1) β go read that one next, bestie π«Ά
ngl the whole point here is: measure first, don't just vibe-guess your wal_sync_method π
and that's the whole page, no cap π this one's from PostgreSQL 13.23, dated 2025 β mwah, go run it on your own hardware and slay β¨π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13-contrib 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13-contrib 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13-contrib 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13-contrib 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms