PG_TEST_FSYNC(1)

πŸ“¦ version 13.23, in opensuse-leap 16.0

πŸ¦‹ 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 the pg_wal directory is (or will be) placed in. (pg_wal is where the WAL files hang out, in case you were wondering 🧚) the default is pg_test_fsync.out in 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 the pg_test_fsync version and exit. simple, iconic.
  • -?, --help β€” show help about pg_test_fsync command 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 βœ¨πŸ‘‘