pg_test_fsync
benchmarks various fsync methods
TLDR
Test fsync methods
$ pg_test_fsync
Test with specific file$ pg_test_fsync -f [testfile]
SYNOPSIS
pg_test_fsync [options]
DESCRIPTION
pg_test_fsync benchmarks the fsync/flush methods available on the current platform, reporting operations-per-second for each. The results guide the choice of PostgreSQL's `walsyncmethod` (e.g. `fsync`, `fdatasync`, `opensync`, `opendatasync`). Run it on the actual filesystem hosting WAL to get meaningful numbers; cached or virtualized storage will distort results.
PARAMETERS
-f, --filename file
Test file path.-s, --secs-per-test n
Seconds per test.
INSTALL
sudo dnf install postgresql17
sudo apk add postgresql17
sudo zypper install postgresql17
CAVEATS
Requires write access to the target directory. Results are affected by caching layers (hardware, virtualization, filesystem) — benchmark on real production storage for accurate comparisons.
SEE ALSO
pg_test_timing(1), postgres(1)
