PG_WALDUMP(1)
okay so bestie, welcome to PG_WALDUMP(1) from the PostgreSQL 16.15 Documentation π this is the WAL-peeping little tool, and yes, itβs giving main-character debugging energy.
πΈ NAME πΈ
pg_waldump β display a human-readable rendering of the write-ahead log of a PostgreSQL database cluster. itβs literally the WAL translator bestie, no cap.
β¨ SYNOPSIS β¨
pg_waldump [option...] [startseg [endseg]]
π¦ DESCRIPTION π¦
pg_waldump displays the write-ahead log (WAL) and is mainly useful for debugging or educational purposes. thatβs the whole assignment. itβs not here to be your production bestie, itβs here to help you peek at WAL.
this utility can only be run by the user who installed the server, because it requires read-only access to the data directory. so yeah, permissions check first, bestie.
π OPTIONS π
the following command-line options control the location and format of the output:
startsegβ start reading at the specified WAL segment file. this implicitly determines the path in which files will be searched for, and the timeline to use.endsegβ stop after reading the specified WAL segment file.-b,--bkp-detailsβ output detailed information about backup blocks.-B block,--block=blockβ only display records that modify the given block. the relation must also be provided with--relationor-R. no relation, no entry, bestie.-e end,--end=endβ stop reading at the specified WAL location, instead of reading to the end of the log stream.-f,--followβ after reaching the end of valid WAL, keep polling once per second for new WAL to appear.-F fork,--fork=forkβ if provided, only display records that modify blocks in the given fork. the valid values aremainfor the main fork,fsmfor the free space map,vmfor the visibility map, andinitfor the init fork.-n limit,--limit=limitβ display the specified number of records, then stop.-p path,--path=pathβ specifies a directory to search for WAL segment files or a directory with apg_walsubdirectory that contains such files. the default is to search in the current directory, thepg_walsubdirectory of the current directory, and thepg_walsubdirectory ofPGDATA.-q,--quietβ do not print any output, except for errors. this option can be useful when you want to know whether a range of WAL records can be successfully parsed but donβt care about the record contents.-r rmgr,--rmgr=rmgrβ only display records generated by the specified resource manager. you can specify the option multiple times to select multiple resource managers. iflistis passed as name, print a list of valid resource manager names, and exit.
extensions may define custom resource managers, but pg_waldump does not load the extension module and therefore does not recognize custom resource managers by name. instead, you can specify the custom resource managers as custom### where ### is the three-digit resource manager ID. names of this form will always be considered valid. iykyk π«Ά
-R tblspc/db/rel,--relation=tblspc/db/relβ only display records that modify blocks in the given relation. the relation is specified with tablespace OID, database OID, and relfilenode separated by slashes, for example1234/12345/12345. this is the same format used for relations in the programβs output.-s start,--start=startβ WAL location at which to start reading. the default is to start reading the first valid WAL record found in the earliest file found.-t timeline,--timeline=timelineβ timeline from which to read WAL records. the default is to use the value instartseg, if that is specified; otherwise, the default is1. the value can be specified in decimal or hexadecimal, for example17or0x11.-V,--versionβ print thepg_waldumpversion and exit.-w,--fullpageβ only display records that include full page images.-x xid,--xid=xidβ only display records marked with the given transaction ID.-z,--stats[=record]β display summary statistics (number and size of records and full-page images) instead of individual records. optionally generate statistics per-record instead of per-rmgr.
if pg_waldump is terminated by signal SIGINT (Control+C, aka Ctrl+C), the summary of the statistics computed is displayed up to the termination point. this operation is not supported on Windows.
--save-fullpage=save_pathβ save full page images found in the WAL records to thesave_pathdirectory. the images saved are subject to the same filtering and limiting criteria as the records displayed.
the full page images are saved with the following file name format:
TIMELINE-LSN.RELTABLESPACE.DATOID.RELNODE.BLKNO_FORK
the file names are composed of the following parts:
TIMELINEβ the timeline of the WAL segment file where the record is located, formatted as one 8-character hexadecimal number%08X.LSNβ the LSN of the record with this image, formatted as two 8-character hexadecimal numbers%08X-%08X.RELTABLESPACEβ tablespace OID of the block.DATOIDβ database OID of the block.RELNODEβ filenode of the block.BLKNOβ block number of the block.FORKβ the name of the fork the full page image came from, such asmain,fsm,vm, orinit.
-?,--helpβ show help aboutpg_waldumpcommand line arguments, and exit.
π ENVIRONMENT π
PGDATAβ data directory; see also the-poption.PG_COLORβ specifies whether to use color in diagnostic messages. possible values arealways,auto, andnever.
π NOTES π
β οΈ can give wrong results when the server is running. like, for real, do not treat that as gospel, bestie.
only the specified timeline is displayed (or the default, if none is specified). records in other timelines are ignored.
pg_waldump cannot read WAL files with suffix .partial. if those files need to be read, .partial suffix needs to be removed from the file name. thatβs the rule, periodt.
π SEE ALSO π
Section 30.6
xoxo, PostgreSQL 16.15 Β· 2026 Β· PG_WALDUMP(1) π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16-server 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16-server 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16-server 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16-server 16.15-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