Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/ref/pg_waldump.sgml`
7164210a7d09692eb8377bc3eb0a5e1472edfe9fe41b7b390000000100000fa0
<!--
doc/src/sgml/ref/pg_waldump.sgml
PostgreSQL documentation
-->

<refentry id="pgwaldump">
 <indexterm zone="pgwaldump">
  <primary>pg_waldump</primary>
 </indexterm>

 <refmeta>
  <refentrytitle><application>pg_waldump</application></refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>pg_waldump</refname>
  <refpurpose>display a human-readable rendering of the write-ahead log of a <productname>PostgreSQL</productname> database cluster</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
  <cmdsynopsis>
   <command>pg_waldump</command>
   <arg rep="repeat" choice="opt"><option>option</option></arg>
   <arg choice="opt"><option>startseg</option><arg choice="opt"><option>endseg</option></arg></arg>
  </cmdsynopsis>
 </refsynopsisdiv>

 <refsect1 id="r1-app-pgwaldump-1">
  <title>Description</title>
  <para>
   <command>pg_waldump</command> displays the write-ahead log (WAL) and is mainly
   useful for debugging or educational purposes.
  </para>

  <para>
   This utility can only be run by the user who installed the server, because
   it requires read-only access to the data directory.
  </para>
 </refsect1>

 <refsect1>
  <title>Options</title>

   <para>
    The following command-line options control the location and format of the
    output:

    <variablelist>

     <varlistentry>
      <term><replaceable class="parameter">startseg</replaceable></term>
      <listitem>
       <para>
        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.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="parameter">endseg</replaceable></term>
      <listitem>
       <para>
        Stop after reading the specified WAL segment file.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-b</option></term>
      <term><option>--bkp-details</option></term>
      <listitem>
       <para>
        Output detailed information about backup blocks.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-B <replaceable>block</replaceable></option></term>
      <term><option>--block=<replaceable>block</replaceable></option></term>
      <listitem>
       <para>
        Only display records that modify the given block.  The relation must
        also be provided with <option>--relation</option> or
        <option>-R</option>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-e <replaceable>end</replaceable></option></term>
      <term><option>--end=<replaceable>end</replaceable></option></term>
      <listitem>
       <para>
        Stop reading at the specified WAL location, instead of reading to the
        end of the log stream.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-f</option></term>
      <term><option>--follow</option></term>
      <listitem>
       <para>
        After reaching the end of valid WAL, keep polling once per second for
        new WAL to appear.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-F <replaceable>fork</replaceable></option></term>
      <term><option>--fork=<replaceable>fork</replaceable></option></term>
      <listitem>
       <para>
        Only display records that modify blocks in the given fork.
        The valid values are <literal>main</literal> for the main fork,
        <literal>fsm</literal> for the free space map,
        <literal>vm</literal> for the visibility map,
        and <literal>init</literal> for the init fork.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-n <replaceable>limit</replaceable></option></term>
      <term><option>--limit=<replaceable>limit</replaceable></option></term>
      <listitem>
   

Title: pg_waldump: Displaying PostgreSQL Write-Ahead Log
Summary
The pg_waldump utility displays the write-ahead log (WAL) of a PostgreSQL database cluster in a human-readable format, useful for debugging and educational purposes. It requires read-only access to the data directory and can only be run by the user who installed the server. The tool offers various options to control the output, including specifying start and end points for reading WAL segments, filtering by block or fork, and following the log for new entries.