2 doc/src/sgml/ref/pg_waldump.sgml
3 PostgreSQL documentation
6 <refentry id=
"pgwaldump">
7 <indexterm zone=
"pgwaldump">
8 <primary>pg_waldump
</primary>
12 <refentrytitle><application>pg_waldump
</application></refentrytitle>
13 <manvolnum>1</manvolnum>
14 <refmiscinfo>Application
</refmiscinfo>
18 <refname>pg_waldump
</refname>
19 <refpurpose>display a human-readable rendering of the write-ahead log of a
<productname>PostgreSQL
</productname> database cluster
</refpurpose>
24 <command>pg_waldump
</command>
25 <arg rep=
"repeat" choice=
"opt"><option>option
</option></arg>
26 <arg choice=
"opt"><option>startseg
</option><arg choice=
"opt"><option>endseg
</option></arg></arg>
30 <refsect1 id=
"r1-app-pgwaldump-1">
31 <title>Description
</title>
33 <command>pg_waldump
</command> displays the write-ahead log (WAL) and is mainly
34 useful for debugging or educational purposes.
38 This utility can only be run by the user who installed the server, because
39 it requires read-only access to the data directory.
44 <title>Options
</title>
47 The following command-line options control the location and format of the
53 <term><replaceable class=
"parameter">startseg
</replaceable></term>
56 Start reading at the specified WAL segment file. This implicitly determines
57 the path in which files will be searched for, and the timeline to use.
63 <term><replaceable class=
"parameter">endseg
</replaceable></term>
66 Stop after reading the specified WAL segment file.
72 <term><option>-b
</option></term>
73 <term><option>--bkp-details
</option></term>
76 Output detailed information about backup blocks.
82 <term><option>-B
<replaceable>block
</replaceable></option></term>
83 <term><option>--block=
<replaceable>block
</replaceable></option></term>
86 Only display records that modify the given block. The relation must
87 also be provided with
<option>--relation
</option> or
94 <term><option>-e
<replaceable>end
</replaceable></option></term>
95 <term><option>--end=
<replaceable>end
</replaceable></option></term>
98 Stop reading at the specified WAL location, instead of reading to the
99 end of the log stream.
105 <term><option>-f
</option></term>
106 <term><option>--follow
</option></term>
109 After reaching the end of valid WAL, keep polling once per second for
116 <term><option>-F
<replaceable>fork
</replaceable></option></term>
117 <term><option>--fork=
<replaceable>fork
</replaceable></option></term>
120 Only display records that modify blocks in the given fork.
121 The valid values are
<literal>main
</literal> for the main fork,
122 <literal>fsm
</literal> for the free space map,
123 <literal>vm
</literal> for the visibility map,
124 and
<literal>init
</literal> for the init fork.
130 <term><option>-n
<replaceable>limit
</replaceable></option></term>
131 <term><option>--limit=
<replaceable>limit
</replaceable></option></term>
134 Display the specified number of records, then stop.
140 <term><option>-p
<replaceable>path
</replaceable></option></term>
141 <term><option>--path=
<replaceable>path
</replaceable></option></term>
144 Specifies a directory to search for WAL segment files or a
145 directory with a
<literal>pg_wal
</literal> subdirectory that
146 contains such files. The default is to search in the current
147 directory, the
<literal>pg_wal
</literal> subdirectory of the
148 current directory, and the
<literal>pg_wal
</literal> subdirectory
149 of
<envar>PGDATA
</envar>.
155 <term><option>-q
</option></term>
156 <term><option>--quiet
</option></term>
159 Do not print any output, except for errors. This option can be useful
160 when you want to know whether a range of WAL records can be
161 successfully parsed but don't care about the record contents.
167 <term><option>-r
<replaceable>rmgr
</replaceable></option></term>
168 <term><option>--rmgr=
<replaceable>rmgr
</replaceable></option></term>
171 Only display records generated by the specified resource manager. You can
172 specify the option multiple times to select multiple resource managers.
173 If
<literal>list
</literal> is passed as name, print a list of valid resource manager
177 Extensions may define custom resource managers, but
178 <application>pg_waldump
</application> does
179 not load the extension module and therefore does not recognize custom
180 resource managers by name. Instead, you can specify the custom
181 resource managers as
<literal>custom###
</literal> where
182 <replaceable>###
</replaceable> is the three-digit resource manager ID.
183 Names of this form will always be considered valid.
189 <term><option>-R
<replaceable>tblspc
</replaceable>/
<replaceable>db
</replaceable>/
<replaceable>rel
</replaceable></option></term>
190 <term><option>--relation=
<replaceable>tblspc
</replaceable>/
<replaceable>db
</replaceable>/
<replaceable>rel
</replaceable></option></term>
193 Only display records that modify blocks in the given relation. The
194 relation is specified with tablespace OID, database OID, and relfilenode
195 separated by slashes, for example
<literal>1234/
12345/
12345</literal>.
196 This is the same format used for relations in the program's output.
202 <term><option>-s
<replaceable>start
</replaceable></option></term>
203 <term><option>--start=
<replaceable>start
</replaceable></option></term>
206 WAL location at which to start reading. The default is to start reading
207 the first valid WAL record found in the earliest file found.
213 <term><option>-t
<replaceable>timeline
</replaceable></option></term>
214 <term><option>--timeline=
<replaceable>timeline
</replaceable></option></term>
217 Timeline from which to read WAL records. The default is to use the
218 value in
<replaceable>startseg
</replaceable>, if that is specified; otherwise, the
219 default is
1. The value can be specified in decimal or hexadecimal,
220 for example
<literal>17</literal> or
<literal>0x11</literal>.
226 <term><option>-V
</option></term>
227 <term><option>--version
</option></term>
230 Print the
<application>pg_waldump
</application> version and exit.
236 <term><option>-w
</option></term>
237 <term><option>--fullpage
</option></term>
240 Only display records that include full page images.
246 <term><option>-x
<replaceable>xid
</replaceable></option></term>
247 <term><option>--xid=
<replaceable>xid
</replaceable></option></term>
250 Only display records marked with the given transaction ID.
256 <term><option>-z
</option></term>
257 <term><option>--stats[=record]
</option></term>
260 Display summary statistics (number and size of records and
261 full-page images) instead of individual records. Optionally
262 generate statistics per-record instead of per-rmgr.
266 If
<application>pg_waldump
</application> is terminated by signal
267 <systemitem>SIGINT
</systemitem>
268 (
<keycombo action=
"simul"><keycap>Control
</keycap><keycap>C
</keycap></keycombo>),
269 the summary of the statistics computed is displayed up to the
270 termination point. This operation is not supported on
271 <productname>Windows
</productname>.
277 <term><option>--save-fullpage=
<replaceable>save_path
</replaceable></option></term>
280 Save full page images found in the WAL records to the
281 <replaceable>save_path
</replaceable> directory. The images saved
282 are subject to the same filtering and limiting criteria as the
286 The full page images are saved with the following file name format:
287 <literal><replaceable>TIMELINE
</replaceable>-
<replaceable>LSN
</replaceable>.
<replaceable>RELTABLESPACE
</replaceable>.
<replaceable>DATOID
</replaceable>.
<replaceable>RELNODE
</replaceable>.
<replaceable>BLKNO
</replaceable>_
<replaceable>FORK
</replaceable></literal>
289 The file names are composed of the following parts:
294 <entry>Component
</entry>
295 <entry>Description
</entry>
301 <entry>TIMELINE
</entry>
302 <entry>The timeline of the WAL segment file where the record
303 is located formatted as one
8-character hexadecimal number
304 <literal>%
08X
</literal></entry>
309 <entry>The
<acronym>LSN
</acronym> of the record with this image,
310 formatted as two
8-character hexadecimal numbers
311 <literal>%
08X-%
08X
</literal></entry>
315 <entry>RELTABLESPACE
</entry>
316 <entry>tablespace OID of the block
</entry>
320 <entry>DATOID
</entry>
321 <entry>database OID of the block
</entry>
325 <entry>RELNODE
</entry>
326 <entry>filenode of the block
</entry>
331 <entry>block number of the block
</entry>
337 The name of the fork the full page image came from, such as
338 <literal>main
</literal>,
<literal>fsm
</literal>,
339 <literal>vm
</literal>, or
<literal>init
</literal>.
350 <term><option>-?
</option></term>
351 <term><option>--help
</option></term>
354 Show help about
<application>pg_waldump
</application> command line
364 <title>Environment
</title>
368 <term><envar>PGDATA
</envar></term>
371 Data directory; see also the
<option>-p
</option> option.
377 <term><envar>PG_COLOR
</envar></term>
380 Specifies whether to use color in diagnostic messages. Possible values
381 are
<literal>always
</literal>,
<literal>auto
</literal> and
382 <literal>never
</literal>.
392 Can give wrong results when the server is running.
396 Only the specified timeline is displayed (or the default, if none is
397 specified). Records in other timelines are ignored.
401 <application>pg_waldump
</application> cannot read WAL files with suffix
402 <literal>.partial
</literal>. If those files need to be read,
<literal>.partial
</literal>
403 suffix needs to be removed from the file name.
408 <title>See Also
</title>
410 <simplelist type=
"inline">
411 <member><xref linkend=
"wal-internals"/></member>