LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pg_test_fsync

benchmarks various fsync methods

TLDR

Test fsync methods
$ pg_test_fsync
copy
Test with specific file
$ pg_test_fsync -f [testfile]
copy

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
copy
sudo apk add postgresql17
copy
sudo zypper install postgresql17
copy

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

Copied to clipboard
Kai