@@ -399,6 +399,12 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
399399 </entry>
400400 </row>
401401
402+ <row>
403+ <entry><structname>pg_stat_progress_copy</structname><indexterm><primary>pg_stat_progress_copy</primary></indexterm></entry>
404+ <entry>One row for each backend running <command>COPY</command>, showing current progress.
405+ See <xref linkend='copy-progress-reporting'/>.
406+ </entry>
407+ </row>
402408 </tbody>
403409 </tgroup>
404410 </table>
@@ -5247,6 +5253,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
52475253 which support progress reporting are <command>ANALYZE</command>,
52485254 <command>CLUSTER</command>,
52495255 <command>CREATE INDEX</command>, <command>VACUUM</command>,
5256+ <command>COPY</command>,
52505257 and <xref linkend="protocol-replication-base-backup"/> (i.e., replication
52515258 command that <xref linkend="app-pgbasebackup"/> issues to take
52525259 a base backup).
@@ -6396,6 +6403,106 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
63966403 </table>
63976404
63986405 </sect2>
6406+
6407+ <sect2 id="copy-progress-reporting">
6408+ <title>COPY Progress Reporting</title>
6409+
6410+ <indexterm>
6411+ <primary>pg_stat_progress_copy</primary>
6412+ </indexterm>
6413+
6414+ <para>
6415+ Whenever <command>COPY</command> is running, the
6416+ <structname>pg_stat_progress_copy</structname> view will contain one row
6417+ for each backend that is currently running <command>COPY</command> command.
6418+ The table bellow describes the information that will be reported and provide
6419+ information how to interpret it.
6420+ </para>
6421+
6422+ <table id="pg-stat-progress-copy-view" xreflabel="pg_stat_progress_copy">
6423+ <title><structname>pg_stat_progress_copy</structname> View</title>
6424+ <tgroup cols="1">
6425+ <thead>
6426+ <row>
6427+ <entry role="catalog_table_entry"><para role="column_definition">
6428+ Column Type
6429+ </para>
6430+ <para>
6431+ Description
6432+ </para></entry>
6433+ </row>
6434+ </thead>
6435+
6436+ <tbody>
6437+ <row>
6438+ <entry role="catalog_table_entry"><para role="column_definition">
6439+ <structfield>pid</structfield> <type>integer</type>
6440+ </para>
6441+ <para>
6442+ Process ID of backend.
6443+ </para></entry>
6444+ </row>
6445+
6446+ <row>
6447+ <entry role="catalog_table_entry"><para role="column_definition">
6448+ <structfield>datid</structfield> <type>text</type>
6449+ </para>
6450+ <para>
6451+ OID of the database to which this backend is connected.
6452+ </para></entry>
6453+ </row>
6454+
6455+ <row>
6456+ <entry role="catalog_table_entry"><para role="column_definition">
6457+ <structfield>datname</structfield> <type>name</type>
6458+ </para>
6459+ <para>
6460+ Name of the database to which this backend is connected.
6461+ </para></entry>
6462+ </row>
6463+
6464+ <row>
6465+ <entry role="catalog_table_entry"><para role="column_definition">
6466+ <structfield>relid</structfield> <type>oid</type>
6467+ </para>
6468+ <para>
6469+ OID of the table on which the <command>COPY</command> command is executed.
6470+ It is set to 0 if <command>SELECT</command> query is provided.
6471+ </para></entry>
6472+ </row>
6473+
6474+ <row>
6475+ <entry role="catalog_table_entry"><para role="column_definition">
6476+ <structfield>bytes_processed</structfield> <type>bigint</type>
6477+ </para>
6478+ <para>
6479+ Number of bytes already processed by <command>COPY</command> command.
6480+ </para></entry>
6481+ </row>
6482+
6483+ <row>
6484+ <entry role="catalog_table_entry"><para role="column_definition">
6485+ <structfield>bytes_total</structfield> <type>bigint</type>
6486+ </para>
6487+ <para>
6488+ Size of source file for <command>COPY FROM</command> command in bytes.
6489+ It is set to 0 if not available.
6490+ </para></entry>
6491+ </row>
6492+
6493+ <row>
6494+ <entry role="catalog_table_entry"><para role="column_definition">
6495+ <structfield>lines_processed</structfield> <type>bigint</type>
6496+ </para>
6497+ <para>
6498+ Number of lines already processed by <command>COPY</command> command.
6499+ </para></entry>
6500+ </row>
6501+ </tbody>
6502+ </tgroup>
6503+ </table>
6504+ </sect2>
6505+
63996506 </sect1>
64006507
64016508 <sect1 id="dynamic-trace">
0 commit comments