<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >pg_xlogdump</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.6.19 Documentation" HREF="index.html"><LINK REL="UP" TITLE="PostgreSQL Server Applications" HREF="reference-server.html"><LINK REL="PREVIOUS" TITLE="pg_upgrade" HREF="pgupgrade.html"><LINK REL="NEXT" TITLE="postgres" HREF="app-postgres.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2020-09-02T07:27:19"></HEAD ><BODY CLASS="REFENTRY" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="4" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.6.19 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="pg_upgrade" HREF="pgupgrade.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="reference-server.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="postgres" HREF="app-postgres.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="PGXLOGDUMP" ></A ><SPAN CLASS="APPLICATION" >pg_xlogdump</SPAN ></H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN104122" ></A ><H2 >Name</H2 >pg_xlogdump -- display a human-readable rendering of the write-ahead log of a <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > database cluster</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN104126" ></A ><H2 >Synopsis</H2 ><P ><TT CLASS="COMMAND" >pg_xlogdump</TT > [<TT CLASS="OPTION" >option</TT >...] [<TT CLASS="OPTION" >startseg</TT > [<TT CLASS="OPTION" >endseg</TT >] ]</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="R1-APP-PGXLOGDUMP-1" ></A ><H2 >Description</H2 ><P > <TT CLASS="COMMAND" >pg_xlogdump</TT > 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" ><A NAME="AEN104140" ></A ><H2 >Options</H2 ><P > The following command-line options control the location and format of the output: <P ></P ></P><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="REPLACEABLE" ><I >startseg</I ></TT ></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 ><TT CLASS="REPLACEABLE" ><I >endseg</I ></TT ></DT ><DD ><P > Stop after reading the specified log segment file. </P ></DD ><DT ><TT CLASS="OPTION" >-b</TT ><BR><TT CLASS="OPTION" >--bkp-details</TT ></DT ><DD ><P > Output detailed information about backup blocks. </P ></DD ><DT ><TT CLASS="OPTION" >-e <TT CLASS="REPLACEABLE" ><I >end</I ></TT ></TT ><BR><TT CLASS="OPTION" >--end=<TT CLASS="REPLACEABLE" ><I >end</I ></TT ></TT ></DT ><DD ><P > Stop reading at the specified log position, instead of reading to the end of the log stream. </P ></DD ><DT ><TT CLASS="OPTION" >-f</TT ><BR><TT CLASS="OPTION" >--follow</TT ></DT ><DD ><P > After reaching the end of valid WAL, keep polling once per second for new WAL to appear. </P ></DD ><DT ><TT CLASS="OPTION" >-n <TT CLASS="REPLACEABLE" ><I >limit</I ></TT ></TT ><BR><TT CLASS="OPTION" >--limit=<TT CLASS="REPLACEABLE" ><I >limit</I ></TT ></TT ></DT ><DD ><P > Display the specified number of records, then stop. </P ></DD ><DT ><TT CLASS="OPTION" >-p <TT CLASS="REPLACEABLE" ><I >path</I ></TT ></TT ><BR><TT CLASS="OPTION" >--path=<TT CLASS="REPLACEABLE" ><I >path</I ></TT ></TT ></DT ><DD ><P > Specifies a directory to search for log segment files or a directory with a <TT CLASS="LITERAL" >pg_xlog</TT > subdirectory that contains such files. The default is to search in the current directory, the <TT CLASS="LITERAL" >pg_xlog</TT > subdirectory of the current directory, and the <TT CLASS="LITERAL" >pg_xlog</TT > subdirectory of <TT CLASS="ENVAR" >PGDATA</TT >. </P ></DD ><DT ><TT CLASS="OPTION" >-r <TT CLASS="REPLACEABLE" ><I >rmgr</I ></TT ></TT ><BR><TT CLASS="OPTION" >--rmgr=<TT CLASS="REPLACEABLE" ><I >rmgr</I ></TT ></TT ></DT ><DD ><P > Only display records generated by the specified resource manager. If <TT CLASS="LITERAL" >list</TT > is passed as name, print a list of valid resource manager names, and exit. </P ></DD ><DT ><TT CLASS="OPTION" >-s <TT CLASS="REPLACEABLE" ><I >start</I ></TT ></TT ><BR><TT CLASS="OPTION" >--start=<TT CLASS="REPLACEABLE" ><I >start</I ></TT ></TT ></DT ><DD ><P > Log position 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 ><TT CLASS="OPTION" >-t <TT CLASS="REPLACEABLE" ><I >timeline</I ></TT ></TT ><BR><TT CLASS="OPTION" >--timeline=<TT CLASS="REPLACEABLE" ><I >timeline</I ></TT ></TT ></DT ><DD ><P > Timeline from which to read log records. The default is to use the value in <TT CLASS="REPLACEABLE" ><I >startseg</I ></TT >, if that is specified; otherwise, the default is 1. </P ></DD ><DT ><TT CLASS="OPTION" >-V</TT ><BR><TT CLASS="OPTION" >--version</TT ></DT ><DD ><P > Print the <SPAN CLASS="APPLICATION" >pg_xlogdump</SPAN > version and exit. </P ></DD ><DT ><TT CLASS="OPTION" >-x <TT CLASS="REPLACEABLE" ><I >xid</I ></TT ></TT ><BR><TT CLASS="OPTION" >--xid=<TT CLASS="REPLACEABLE" ><I >xid</I ></TT ></TT ></DT ><DD ><P > Only display records marked with the given transaction ID. </P ></DD ><DT ><TT CLASS="OPTION" >-z</TT ><BR><TT CLASS="OPTION" >--stats[=record]</TT ></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 ></DD ><DT ><TT CLASS="OPTION" >-?</TT ><BR><TT CLASS="OPTION" >--help</TT ></DT ><DD ><P > Show help about <SPAN CLASS="APPLICATION" >pg_xlogdump</SPAN > command line arguments, and exit. </P ></DD ></DL ></DIV ><P> </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN104260" ></A ><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_xlogdump</SPAN > cannot read WAL files with suffix <TT CLASS="LITERAL" >.partial</TT >. If those files need to be read, <TT CLASS="LITERAL" >.partial</TT > suffix needs to be removed from the file name. </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN104268" ></A ><H2 >See Also</H2 ><A HREF="wal-internals.html" >Section 30.5</A ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="pgupgrade.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="app-postgres.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><SPAN CLASS="APPLICATION" >pg_upgrade</SPAN ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="reference-server.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><SPAN CLASS="APPLICATION" >postgres</SPAN ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >