summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/pgwaldump.html
blob: 9346c1b8c2f382ab3618e7409689343cd293439f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_waldump</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="pgupgrade.html" title="pg_upgrade" /><link rel="next" href="app-postgres.html" title="postgres" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span class="application">pg_waldump</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pgupgrade.html" title="pg_upgrade">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-server.html" title="PostgreSQL Server Applications">Up</a></td><th width="60%" align="center">PostgreSQL Server Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-postgres.html" title="postgres">Next</a></td></tr></table><hr /></div><div class="refentry" id="PGWALDUMP"><div class="titlepage"></div><a id="id-1.9.5.13.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_waldump</span></span></h2><p>pg_waldump — display a human-readable rendering of the write-ahead log of a <span class="productname">PostgreSQL</span> database cluster</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.5.13.4.1"><code class="command">pg_waldump</code> [<code class="option">option</code>...] [<code class="option">startseg</code> [<code class="option">endseg</code>]]</p></div></div><div class="refsect1" id="R1-APP-PGWALDUMP-1"><h2>Description</h2><p>
   <code class="command">pg_waldump</code> displays the write-ahead log (WAL) and is mainly
   useful for debugging or educational purposes.
  </p><p>
   This utility can only be run by the user who installed the server, because
   it requires read-only access to the data directory.
  </p></div><div class="refsect1" id="id-1.9.5.13.6"><h2>Options</h2><p>
    The following command-line options control the location and format of the
    output:

    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>startseg</code></em></span></dt><dd><p>
        Start reading at the specified log segment file.  This implicitly determines
        the path in which files will be searched for, and the timeline to use.
       </p></dd><dt><span class="term"><em class="replaceable"><code>endseg</code></em></span></dt><dd><p>
        Stop after reading the specified log segment file.
       </p></dd><dt><span class="term"><code class="option">-b</code><br /></span><span class="term"><code class="option">--bkp-details</code></span></dt><dd><p>
        Output detailed information about backup blocks.
       </p></dd><dt><span class="term"><code class="option">-B <em class="replaceable"><code>block</code></em></code><br /></span><span class="term"><code class="option">--block=<em class="replaceable"><code>block</code></em></code></span></dt><dd><p>
        Only display records that modify the given block.  The relation must
        also be provided with <code class="option">--relation</code> or
        <code class="option">-R</code>.
       </p></dd><dt><span class="term"><code class="option">-e <em class="replaceable"><code>end</code></em></code><br /></span><span class="term"><code class="option">--end=<em class="replaceable"><code>end</code></em></code></span></dt><dd><p>
        Stop reading at the specified WAL location, instead of reading to the
        end of the log stream.
       </p></dd><dt><span class="term"><code class="option">-f</code><br /></span><span class="term"><code class="option">--follow</code></span></dt><dd><p>
        After reaching the end of valid WAL, keep polling once per second for
        new WAL to appear.
       </p></dd><dt><span class="term"><code class="option">-F <em class="replaceable"><code>fork</code></em></code><br /></span><span class="term"><code class="option">--fork=<em class="replaceable"><code>fork</code></em></code></span></dt><dd><p>
        If provided, only display records that modify blocks in the given fork.
        The valid values are <code class="literal">main</code> for the main fork,
        <code class="literal">fsm</code> for the free space map,
        <code class="literal">vm</code> for the visibility map,
        and <code class="literal">init</code> for the init fork.
       </p></dd><dt><span class="term"><code class="option">-n <em class="replaceable"><code>limit</code></em></code><br /></span><span class="term"><code class="option">--limit=<em class="replaceable"><code>limit</code></em></code></span></dt><dd><p>
        Display the specified number of records, then stop.
       </p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>path</code></em></code><br /></span><span class="term"><code class="option">--path=<em class="replaceable"><code>path</code></em></code></span></dt><dd><p>
        Specifies a directory to search for log segment files or a
        directory with a <code class="literal">pg_wal</code> subdirectory that
        contains such files.  The default is to search in the current
        directory, the <code class="literal">pg_wal</code> subdirectory of the
        current directory, and the <code class="literal">pg_wal</code> subdirectory
        of <code class="envar">PGDATA</code>.
       </p></dd><dt><span class="term"><code class="option">-q</code><br /></span><span class="term"><code class="option">--quiet</code></span></dt><dd><p>
        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.
       </p></dd><dt><span class="term"><code class="option">-r <em class="replaceable"><code>rmgr</code></em></code><br /></span><span class="term"><code class="option">--rmgr=<em class="replaceable"><code>rmgr</code></em></code></span></dt><dd><p>
        Only display records generated by the specified resource manager. You can
        specify the option multiple times to select multiple resource managers.
        If <code class="literal">list</code> is passed as name, print a list of valid resource manager
        names, and exit.
       </p><p>
        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 <code class="literal">custom###</code> where
        "<code class="literal">###</code>" is the three-digit resource manager ID. Names
        of this form will always be considered valid.
       </p></dd><dt><span class="term"><code class="option">-R <em class="replaceable"><code>tblspc</code></em>/<em class="replaceable"><code>db</code></em>/<em class="replaceable"><code>rel</code></em></code><br /></span><span class="term"><code class="option">--relation=<em class="replaceable"><code>tblspc</code></em>/<em class="replaceable"><code>db</code></em>/<em class="replaceable"><code>rel</code></em></code></span></dt><dd><p>
        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 example <code class="literal">1234/12345/12345</code>.
        This is the same format used for relations in the program's output.
       </p></dd><dt><span class="term"><code class="option">-s <em class="replaceable"><code>start</code></em></code><br /></span><span class="term"><code class="option">--start=<em class="replaceable"><code>start</code></em></code></span></dt><dd><p>
        WAL location at which to start reading. The default is to start reading
        the first valid log record found in the earliest file found.
       </p></dd><dt><span class="term"><code class="option">-t <em class="replaceable"><code>timeline</code></em></code><br /></span><span class="term"><code class="option">--timeline=<em class="replaceable"><code>timeline</code></em></code></span></dt><dd><p>
        Timeline from which to read log records. The default is to use the
        value in <em class="replaceable"><code>startseg</code></em>, if that is specified; otherwise, the
        default is 1.
       </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
       Print the <span class="application">pg_waldump</span> version and exit.
       </p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--fullpage</code></span></dt><dd><p>
        Only display records that include full page images.
       </p></dd><dt><span class="term"><code class="option">-x <em class="replaceable"><code>xid</code></em></code><br /></span><span class="term"><code class="option">--xid=<em class="replaceable"><code>xid</code></em></code></span></dt><dd><p>
        Only display records marked with the given transaction ID.
       </p></dd><dt><span class="term"><code class="option">-z</code><br /></span><span class="term"><code class="option">--stats[=record]</code></span></dt><dd><p>
        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.
       </p><p>
        If <span class="application">pg_waldump</span> is terminated by signal
        <span class="systemitem">SIGINT</span>
        (<span class="keycap"><strong>Control</strong></span>+<span class="keycap"><strong>C</strong></span>),
        the summary of the statistics computed is displayed up to the
        termination point. This operation is not supported on
        <span class="productname">Windows</span>.
       </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
         Show help about <span class="application">pg_waldump</span> command line
         arguments, and exit.
        </p></dd></dl></div><p>
   </p></div><div class="refsect1" id="id-1.9.5.13.7"><h2>Environment</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGDATA</code></span></dt><dd><p>
      Data directory; see also the <code class="option">-p</code> option.
     </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
      Specifies whether to use color in diagnostic messages. Possible values
      are <code class="literal">always</code>, <code class="literal">auto</code> and
      <code class="literal">never</code>.
     </p></dd></dl></div></div><div class="refsect1" id="id-1.9.5.13.8"><h2>Notes</h2><p>
    Can give wrong results when the server is running.
  </p><p>
    Only the specified timeline is displayed (or the default, if none is
    specified). Records in other timelines are ignored.
  </p><p>
    <span class="application">pg_waldump</span> cannot read WAL files with suffix
    <code class="literal">.partial</code>. If those files need to be read, <code class="literal">.partial</code>
    suffix needs to be removed from the file name.
  </p></div><div class="refsect1" id="id-1.9.5.13.9"><h2>See Also</h2><span class="simplelist"><a class="xref" href="wal-internals.html" title="30.6. WAL Internals">Section 30.6</a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pgupgrade.html" title="pg_upgrade">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-server.html" title="PostgreSQL Server Applications">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-postgres.html" title="postgres">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_upgrade</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">postgres</span></td></tr></table></div></body></html>