Top
Enterprise Postgres 17 Operation Guide

13.2.2 Checking Progress

If you are performing a data load with a large external file as input, you can verify that the process is continuing by getting progress information during the load. Progress information can be obtained from the pgx_stat_progress_loader view. This view displays the sum of the progress information of the back-end process and the number of parallel worker processes. Search the pgx_stat_progress_loader view, for example, with a SELECT statement, to locate the appropriate row. After running the pgx_loader command, look in the pg_stat_activity view and locate a row in the pgx_stat_progress_loader view with the PID obtained.

Example

  1. See the pg_stat_activity view. (9311 for back-end processes, 9312, 9313, 9314 for worker processes)

    postgres=# select pid, application_name, backend_type from pg_stat_activity
    pid  | application_name |         backend_type
    -----+------------------+------------------------------
    6216 |                  | autovacuum launcher
    6218 |                  | logical replication launcher
    6271 | psql             | client backend
    9311 | pgx_loader       | client backend
    9312 |                  | parallel loader for PID 9311
    9313 |                  | parallel loader for PID 9311
    9314 |                  | parallel loader for PID 9311
    6214 |                  | background writer
    6213 |                  | checkpointer
    6215 |                  | walwriter
  2. Check the information in the pgx_stat_progress_loader view.

    postgres=# SELECT * FROM pgx_stat_progress_loader
    pid  | datid | datname | relid | command  | type | bytes_processed | bytes_total | tuples_processed | tuples_excluded
    -----+-------+---------+-------+----------+------+-----------------+-------------+------------------+----------------
    9311 |  222  | testdb  | 333   |COPY FROM | FILE |         192000  |    450000   |         189000   |           3000

Refer to "D.7 pgx_stat_progress_loader" for information on the pgx_stat_progress_loader view.

Note

When you run the pgx_loader command, the PostgreSQL pg_stat_progress_copy view prints the progress of the back-end process and the number of parallel worker processes on each line. The backend process progress information tuples_processed, tuples_excluded is 0. Also, bytes_processed and bytes_total for worker processes are 0.

postgres=# SELECT * FROM pg_stat_progress_copy
pid  | datid | datname | relid | command  | type | bytes_processed | bytes_total | tuples_processed | tuples_excluded
-----+-------+---------+-------+----------+------+-----------------+-------------+------------------+----------------
9311 |  222  | testdb  | 333   |COPY FROM | FILE |         192000  |    450000   |              0   |              0
9312 |  222  | testdb  | 333   |COPY FROM | FILE |              0  |         0   |          63000   |           1000
9313 |  222  | testdb  | 333   |COPY FROM | FILE |              0  |         0   |          63000   |           1000
9314 |  222  | testdb  | 333   |COPY FROM | FILE |              0  |         0   |          63000   |           1000

Refer to "pg_stat_progress_copy View" in the PostgreSQL Documentation for information on the pg_stat_progress_copy view.