codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!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 16.3 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>3 <code class="command">pg_waldump</code> displays the write-ahead log (WAL) and is mainly4 useful for debugging or educational purposes.5 </p><p>6 This utility can only be run by the user who installed the server, because7 it requires read-only access to the data directory.8 </p></div><div class="refsect1" id="id-1.9.5.13.6"><h2>Options</h2><p>9 The following command-line options control the location and format of the10 output:11 12 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>startseg</code></em></span></dt><dd><p>13 Start reading at the specified WAL segment file. This implicitly determines14 the path in which files will be searched for, and the timeline to use.15 </p></dd><dt><span class="term"><em class="replaceable"><code>endseg</code></em></span></dt><dd><p>16 Stop after reading the specified WAL segment file.17 </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>18 Output detailed information about backup blocks.19 </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>20 Only display records that modify the given block. The relation must21 also be provided with <code class="option">--relation</code> or22 <code class="option">-R</code>.23 </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>24 Stop reading at the specified WAL location, instead of reading to the25 end of the log stream.26 </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>27 After reaching the end of valid WAL, keep polling once per second for28 new WAL to appear.29 </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>30 If provided, only display records that modify blocks in the given fork.31 The valid values are <code class="literal">main</code> for the main fork,32 <code class="literal">fsm</code> for the free space map,33 <code class="literal">vm</code> for the visibility map,34 and <code class="literal">init</code> for the init fork.35 </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>36 Display the specified number of records, then stop.37 </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>38 Specifies a directory to search for WAL segment files or a39 directory with a <code class="literal">pg_wal</code> subdirectory that40 contains such files. The default is to search in the current41 directory, the <code class="literal">pg_wal</code> subdirectory of the42 current directory, and the <code class="literal">pg_wal</code> subdirectory43 of <code class="envar">PGDATA</code>.44 </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>45 Do not print any output, except for errors. This option can be useful46 when you want to know whether a range of WAL records can be47 successfully parsed but don't care about the record contents.48 </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>49 Only display records generated by the specified resource manager. You can50 specify the option multiple times to select multiple resource managers.51 If <code class="literal">list</code> is passed as name, print a list of valid resource manager52 names, and exit.53 </p><p>54 Extensions may define custom resource managers, but pg_waldump does55 not load the extension module and therefore does not recognize custom56 resource managers by name. Instead, you can specify the custom57 resource managers as <code class="literal">custom###</code> where58 "<code class="literal">###</code>" is the three-digit resource manager ID. Names59 of this form will always be considered valid.60 </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>61 Only display records that modify blocks in the given relation. The62 relation is specified with tablespace OID, database OID, and relfilenode63 separated by slashes, for example <code class="literal">1234/12345/12345</code>.64 This is the same format used for relations in the program's output.65 </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>66 WAL location at which to start reading. The default is to start reading67 the first valid WAL record found in the earliest file found.68 </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>69 Timeline from which to read WAL records. The default is to use the70 value in <em class="replaceable"><code>startseg</code></em>, if that is specified; otherwise, the71 default is 1. The value can be specified in decimal or hexadecimal,72 for example <code class="literal">17</code> or <code class="literal">0x11</code>.73 </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>74 Print the <span class="application">pg_waldump</span> version and exit.75 </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>76 Only display records that include full page images.77 </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>78 Only display records marked with the given transaction ID.79 </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>80 Display summary statistics (number and size of records and81 full-page images) instead of individual records. Optionally82 generate statistics per-record instead of per-rmgr.83 </p><p>84 If <span class="application">pg_waldump</span> is terminated by signal85 <span class="systemitem">SIGINT</span>86 (<span class="keycap"><strong>Control</strong></span>+<span class="keycap"><strong>C</strong></span>),87 the summary of the statistics computed is displayed up to the88 termination point. This operation is not supported on89 <span class="productname">Windows</span>.90 </p></dd><dt><span class="term"><code class="option">--save-fullpage=<em class="replaceable"><code>save_path</code></em></code></span></dt><dd><p>91 Save full page images found in the WAL records to the92 <em class="replaceable"><code>save_path</code></em> directory. The images saved93 are subject to the same filtering and limiting criteria as the94 records displayed.95 </p><p>96 The full page images are saved with the following file name format:97 <code class="literal"><em class="replaceable"><code>TIMELINE</code></em>-<em class="replaceable"><code>LSN</code></em>.<em class="replaceable"><code>RELTABLESPACE</code></em>.<em class="replaceable"><code>DATOID</code></em>.<em class="replaceable"><code>RELNODE</code></em>.<em class="replaceable"><code>BLKNO</code></em><em class="replaceable"><code>FORK</code></em></code>98 99 The file names are composed of the following parts:100 </p><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Component</th><th>Description</th></tr></thead><tbody><tr><td>TIMELINE</td><td>The timeline of the WAL segment file where the record101 is located formatted as one 8-character hexadecimal number102 <code class="literal">%08X</code></td></tr><tr><td>LSN</td><td>The <acronym class="acronym">LSN</acronym> of the record with this image,103 formatted as two 8-character hexadecimal numbers104 <code class="literal">%08X-%08X</code></td></tr><tr><td>RELTABLESPACE</td><td>tablespace OID of the block</td></tr><tr><td>DATOID</td><td>database OID of the block</td></tr><tr><td>RELNODE</td><td>filenode of the block</td></tr><tr><td>BLKNO</td><td>block number of the block</td></tr><tr><td>FORK</td><td>105 The name of the fork the full page image came from, such as106 <code class="literal">_main</code>, <code class="literal">_fsm</code>,107 <code class="literal">_vm</code>, or <code class="literal">_init</code>.108 </td></tr></tbody></table></div><p>109 </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>110 Show help about <span class="application">pg_waldump</span> command line111 arguments, and exit.112 </p></dd></dl></div><p>113 </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>114 Data directory; see also the <code class="option">-p</code> option.115 </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>116 Specifies whether to use color in diagnostic messages. Possible values117 are <code class="literal">always</code>, <code class="literal">auto</code> and118 <code class="literal">never</code>.119 </p></dd></dl></div></div><div class="refsect1" id="id-1.9.5.13.8"><h2>Notes</h2><p>120 Can give wrong results when the server is running.121 </p><p>122 Only the specified timeline is displayed (or the default, if none is123 specified). Records in other timelines are ignored.124 </p><p>125 <span class="application">pg_waldump</span> cannot read WAL files with suffix126 <code class="literal">.partial</code>. If those files need to be read, <code class="literal">.partial</code>127 suffix needs to be removed from the file name.128 </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 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">postgres</span></td></tr></table></div></body></html>