pg_waldump
pg_waldump — display a human-readable rendering of the write-ahead log of a PostgreSQL database cluster
Synopsis
pg_waldump [option...] [startseg [endseg]]
Description
pg_waldump displays the write-ahead log (WAL) and is mainly useful for debugging or educational purposes.
This utility can only be run by the user who installed the server, because it requires read-only access to the data directory.
Options
The following command-line options control the location and format of the output:
startsegStart reading at the specified log segment file. This implicitly determines the path in which files will be searched for, and the timeline to use.
endsegStop after reading the specified log segment file.
-b--bkp-detailsOutput detailed information about backup blocks.
-Bblock--block=blockOnly display records that modify the given block. The relation must also be provided with
--relationor-R.-eend--end=endStop reading at the specified WAL location, instead of reading to the end of the log stream.
-f--followAfter reaching the end of valid WAL, keep polling once per second for new WAL to appear.
-Ffork--fork=forkIf provided, only display records that modify blocks in the given fork. The valid values are
mainfor the main fork,fsmfor the free space map,vmfor the visibility map, andinitfor the init fork.-nlimit--limit=limitDisplay the specified number of records, then stop.
-ppath--path=pathSpecifies a directory to search for log segment files or a directory with a
pg_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--quietDo 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.
-rrmgr--rmgr=rmgrOnly display records generated by the specified resource manager. You can specify the option multiple times to select multiple resource managers. If
listis 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.-Rtblspc/db/rel--relation=tblspc/db/relOnly display records that modify blocks in the given relation. The relation is specified with tablespace OID, database OID, and relfilenode separated by slashes, for example
1234/12345/12345. This is the same format used for relations in the program's output.-sstart--start=startWAL location at which to start reading. The default is to start reading the first valid log record found in the earliest file found.
-ttimeline--timeline=timelineTimeline from which to read log records. The default is to use the value in
startseg, if that is specified; otherwise, the default is 1.-V--versionPrint the pg_waldump version and exit.
-w--fullpageOnly display records that include full page images.
-xxid--xid=xidOnly 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), the summary of the statistics computed is displayed up to the termination point. This operation is not supported on Windows.
-?--helpShow help about pg_waldump command line arguments, and exit.
Environment
PGDATAData directory; see also the
-poption.PG_COLORSpecifies whether to use color in diagnostic messages. Possible values are
always,autoandnever.
Notes
Can give wrong results when the server is running.
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.