Summary
Whenever COPY is running, the pg_stat_progress_copy view will contain one row for each backend that is currently running a COPY command. The table below describes the information that will be reported and provides information about how to interpret it.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_stat_progress_copy statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
pidinteger
Process ID of backend.datidoid
OID of the database to which this backend is connected.datnamename
Name of the database to which this backend is connected.relidoid
OID of the table on which the COPY command is executed. It is set to 0 if copying from a SELECT query.commandtext
The command that is running: COPY FROM, or COPY TO.typetext
The I/O type that the data is read from or written to: FILE, PROGRAM, PIPE (for COPY FROM STDIN and COPY TO STDOUT), or CALLBACK (used for example during the initial table synchronization in logical replication).bytes_processedbigint
Number of bytes already processed by COPY command.bytes_totalbigint
Size of source file for COPY FROM command in bytes. It is set to 0 if not available.tuples_processedbigint
Number of tuples already processed by COPY command.tuples_excludedbigint
Number of tuples not processed because they were excluded by the WHERE clause of the COPY command.tuples_skippedbigint
Number of tuples skipped because they contain malformed data. This counter only advances when ignore is specified to the ON_ERROR option.
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_stat_progress_copy.