@@ -405,6 +405,14 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
405405      </entry>
406406     </row>
407407
408+      <row>
409+       <entry><structname>pg_stat_progress_repack</structname><indexterm><primary>pg_stat_progress_repack</primary></indexterm></entry>
410+       <entry>One row for each backend running
411+        <command>REPACK</command>, showing current progress.  See
412+        <xref linkend="repack-progress-reporting"/>.
413+       </entry>
414+      </row>
415+ 
408416     <row>
409417      <entry><structname>pg_stat_progress_basebackup</structname><indexterm><primary>pg_stat_progress_basebackup</primary></indexterm></entry>
410418      <entry>One row for each WAL sender process streaming a base backup,
@@ -5575,7 +5583,8 @@ FROM pg_stat_get_backend_idset() AS backendid;
55755583   certain commands during command execution.  Currently, the only commands
55765584   which support progress reporting are <command>ANALYZE</command>,
55775585   <command>CLUSTER</command>,
5578-    <command>CREATE INDEX</command>, <command>VACUUM</command>,
5586+    <command>CREATE INDEX</command>, <command>REPACK</command>,
5587+    <command>VACUUM</command>,
55795588   <command>COPY</command>,
55805589   and <xref linkend="protocol-replication-base-backup"/> (i.e., replication
55815590   command that <xref linkend="app-pgbasebackup"/> issues to take
@@ -6034,6 +6043,218 @@ FROM pg_stat_get_backend_idset() AS backendid;
60346043  </table>
60356044 </sect2>
60366045
6046+  <sect2 id="repack-progress-reporting">
6047+   <title>REPACK Progress Reporting</title>
6048+ 
6049+   <indexterm>
6050+    <primary>pg_stat_progress_repack</primary>
6051+   </indexterm>
6052+ 
6053+   <para>
6054+    Whenever <command>REPACK</command> is running,
6055+    the <structname>pg_stat_progress_repack</structname> view will contain a
6056+    row for each backend that is currently running the command.  The tables
6057+    below describe the information that will be reported and provide
6058+    information about how to interpret it.
6059+   </para>
6060+ 
6061+   <table id="pg-stat-progress-repack-view" xreflabel="pg_stat_progress_repack">
6062+    <title><structname>pg_stat_progress_repack</structname> View</title>
6063+    <tgroup cols="1">
6064+     <thead>
6065+      <row>
6066+       <entry role="catalog_table_entry"><para role="column_definition">
6067+        Column Type
6068+       </para>
6069+       <para>
6070+        Description
6071+       </para></entry>
6072+      </row>
6073+     </thead>
6074+ 
6075+     <tbody>
6076+      <row>
6077+       <entry role="catalog_table_entry"><para role="column_definition">
6078+        <structfield>pid</structfield> <type>integer</type>
6079+       </para>
6080+       <para>
6081+        Process ID of backend.
6082+       </para></entry>
6083+      </row>
6084+ 
6085+      <row>
6086+       <entry role="catalog_table_entry"><para role="column_definition">
6087+        <structfield>datid</structfield> <type>oid</type>
6088+       </para>
6089+       <para>
6090+        OID of the database to which this backend is connected.
6091+       </para></entry>
6092+      </row>
6093+ 
6094+      <row>
6095+       <entry role="catalog_table_entry"><para role="column_definition">
6096+        <structfield>datname</structfield> <type>name</type>
6097+       </para>
6098+       <para>
6099+        Name of the database to which this backend is connected.
6100+       </para></entry>
6101+      </row>
6102+ 
6103+      <row>
6104+       <entry role="catalog_table_entry"><para role="column_definition">
6105+        <structfield>relid</structfield> <type>oid</type>
6106+       </para>
6107+       <para>
6108+        OID of the table being repacked.
6109+       </para></entry>
6110+      </row>
6111+ 
6112+      <row>
6113+       <entry role="catalog_table_entry"><para role="column_definition">
6114+        <structfield>phase</structfield> <type>text</type>
6115+       </para>
6116+       <para>
6117+        Current processing phase. See <xref linkend="repack-phases"/>.
6118+       </para></entry>
6119+      </row>
6120+ 
6121+      <row>
6122+       <entry role="catalog_table_entry"><para role="column_definition">
6123+        <structfield>repack_index_relid</structfield> <type>oid</type>
6124+       </para>
6125+       <para>
6126+        If the table is being scanned using an index, this is the OID of the
6127+        index being used; otherwise, it is zero.
6128+       </para></entry>
6129+      </row>
6130+ 
6131+      <row>
6132+       <entry role="catalog_table_entry"><para role="column_definition">
6133+        <structfield>heap_tuples_scanned</structfield> <type>bigint</type>
6134+       </para>
6135+       <para>
6136+        Number of heap tuples scanned.
6137+        This counter only advances when the phase is
6138+        <literal>seq scanning heap</literal>,
6139+        <literal>index scanning heap</literal>
6140+        or <literal>writing new heap</literal>.
6141+       </para></entry>
6142+      </row>
6143+ 
6144+      <row>
6145+       <entry role="catalog_table_entry"><para role="column_definition">
6146+        <structfield>heap_tuples_written</structfield> <type>bigint</type>
6147+       </para>
6148+       <para>
6149+        Number of heap tuples written.
6150+        This counter only advances when the phase is
6151+        <literal>seq scanning heap</literal>,
6152+        <literal>index scanning heap</literal>
6153+        or <literal>writing new heap</literal>.
6154+       </para></entry>
6155+      </row>
6156+ 
6157+      <row>
6158+       <entry role="catalog_table_entry"><para role="column_definition">
6159+        <structfield>heap_blks_total</structfield> <type>bigint</type>
6160+       </para>
6161+       <para>
6162+        Total number of heap blocks in the table.  This number is reported
6163+        as of the beginning of <literal>seq scanning heap</literal>.
6164+       </para></entry>
6165+      </row>
6166+ 
6167+      <row>
6168+       <entry role="catalog_table_entry"><para role="column_definition">
6169+        <structfield>heap_blks_scanned</structfield> <type>bigint</type>
6170+       </para>
6171+       <para>
6172+        Number of heap blocks scanned.  This counter only advances when the
6173+        phase is <literal>seq scanning heap</literal>.
6174+       </para></entry>
6175+      </row>
6176+ 
6177+      <row>
6178+       <entry role="catalog_table_entry"><para role="column_definition">
6179+        <structfield>index_rebuild_count</structfield> <type>bigint</type>
6180+       </para>
6181+       <para>
6182+        Number of indexes rebuilt.  This counter only advances when the phase
6183+        is <literal>rebuilding index</literal>.
6184+       </para></entry>
6185+      </row>
6186+     </tbody>
6187+    </tgroup>
6188+   </table>
6189+ 
6190+   <table id="repack-phases">
6191+    <title>REPACK Phases</title>
6192+    <tgroup cols="2">
6193+     <colspec colname="col1" colwidth="1*"/>
6194+     <colspec colname="col2" colwidth="2*"/>
6195+     <thead>
6196+     <row>
6197+       <entry>Phase</entry>
6198+       <entry>Description</entry>
6199+      </row>
6200+     </thead>
6201+ 
6202+    <tbody>
6203+     <row>
6204+      <entry><literal>initializing</literal></entry>
6205+      <entry>
6206+        The command is preparing to begin scanning the heap.  This phase is
6207+        expected to be very brief.
6208+      </entry>
6209+     </row>
6210+     <row>
6211+      <entry><literal>seq scanning heap</literal></entry>
6212+      <entry>
6213+        The command is currently scanning the table using a sequential scan.
6214+      </entry>
6215+     </row>
6216+     <row>
6217+      <entry><literal>index scanning heap</literal></entry>
6218+      <entry>
6219+        <command>REPACK</command> is currently scanning the table using an index scan.
6220+      </entry>
6221+     </row>
6222+     <row>
6223+      <entry><literal>sorting tuples</literal></entry>
6224+      <entry>
6225+        <command>REPACK</command> is currently sorting tuples.
6226+      </entry>
6227+     </row>
6228+     <row>
6229+      <entry><literal>writing new heap</literal></entry>
6230+      <entry>
6231+        <command>REPACK</command> is currently writing the new heap.
6232+      </entry>
6233+     </row>
6234+     <row>
6235+      <entry><literal>swapping relation files</literal></entry>
6236+      <entry>
6237+        The command is currently swapping newly-built files into place.
6238+      </entry>
6239+     </row>
6240+     <row>
6241+      <entry><literal>rebuilding index</literal></entry>
6242+      <entry>
6243+        The command is currently rebuilding an index.
6244+      </entry>
6245+     </row>
6246+     <row>
6247+      <entry><literal>performing final cleanup</literal></entry>
6248+      <entry>
6249+        The command is performing final cleanup.  When this phase is
6250+        completed, <command>REPACK</command> will end.
6251+      </entry>
6252+     </row>
6253+    </tbody>
6254+    </tgroup>
6255+   </table>
6256+  </sect2>
6257+ 
60376258 <sect2 id="copy-progress-reporting">
60386259  <title>COPY Progress Reporting</title>
60396260
0 commit comments