PG_CHECKSUMS(1)

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

πŸ’– PG_CHECKSUMS(1) πŸ’–

okay so welcome to the PostgreSQL 15.19 Documentation page for pg_checksums, bestie! This is the whole manual, but make it make sense. ✨


✨ NAME ✨

pg_checksums β€” enable, disable or check data checksums in a PostgreSQL database cluster. That's the main character energy of this page. πŸ’…

🌸 SYNOPSIS 🌸

Here's the shape of it, no cap:

pg_checksums [option...] [[-D | --pgdata]datadir]

πŸ¦‹ DESCRIPTION πŸ¦‹

So pg_checksums checks, enables or disables data checksums in a PostgreSQL cluster. Three modes, one icon. πŸ’–

🚨 Important: the server must be shut down cleanly before running pg_checksums. Clean shutdown only, bestie.

When it's verifying checksums, the exit status is zero if there are no checksum errors, and nonzero if at least one checksum failure is detected. When enabling or disabling checksums, the exit status is nonzero if the operation failed. Exit status tea β˜•

When verifying checksums, every file in the cluster is scanned. When enabling checksums, each relation file block with a changed checksum is rewritten in-place. Disabling checksums only updates the file pg_control. That's the whole flow. 🫢

πŸ‘‘ OPTIONS πŸ‘‘

The following command-line options are available β€” every single flag, no skips:

  • -D directory, --pgdata=directory β€” Specifies the directory where the database cluster is stored. πŸ—‚οΈ
  • -c, --check β€” Checks checksums. This is the default mode if nothing else is specified. βœ…
  • -d, --disable β€” Disables checksums. 🚫
  • -e, --enable β€” Enables checksums. 🟒
  • -f filenode, --filenode=filenode β€” Only validate checksums in the relation with filenode filenode. πŸ”
  • -N, --no-sync β€” By default, pg_checksums will wait for all files to be written safely to disk. This option causes pg_checksums to return without waiting, which is faster, but means that a subsequent operating system crash can leave the updated data directory corrupt. Generally, this option is useful for testing but should not be used on a production installation. This option has no effect when using --check. 🫠
  • -P, --progress β€” Enable progress reporting. Turning this on will deliver a progress report while checking or enabling checksums. πŸ“Š
  • -v, --verbose β€” Enable verbose output. Lists all checked files. πŸ—£οΈ
  • -V, --version β€” Print the pg_checksums version and exit. 🏷️
  • -?, --help β€” Show help about pg_checksums command line arguments, and exit. ❓

🌈 ENVIRONMENT 🌈

  • PGDATA β€” Specifies the directory where the database cluster is stored; can be overridden using the -D option. πŸ“
  • PG_COLOR β€” Specifies whether to use color in diagnostic messages. Possible values are always, auto and never. 🎨

πŸ”₯ NOTES πŸ”₯

Enabling checksums in a large cluster can potentially take a long time. During this operation, the cluster or other programs that write to the data directory must not be started or else data loss may occur. Like, actually important. 😭

When using a replication setup with tools which perform direct copies of relation file blocks (for example pg_rewind(1)), enabling or disabling checksums can lead to page corruptions in the shape of incorrect checksums if the operation is not done consistently across all nodes. When enabling or disabling checksums in a replication setup, it is thus recommended to stop all the clusters before switching them all consistently. Destroying all standbys, performing the operation on the primary and finally recreating the standbys from scratch is also safe. Replication girlies, take notes. πŸ“

If pg_checksums is aborted or killed while enabling or disabling checksums, the cluster's data checksum configuration remains unchanged, and pg_checksums can be re-run to perform the same operation. So you can just run it back. πŸ’…


That's the page, bestie! πŸ’– Source/version: PostgreSQL 15.19; date: 2026; manual: PG_CHECKSUMS(1). Go off and slay those checksums! πŸŽ€βœ¨

πŸ“¦ where this page comes from