Monitoring the progress of commands
PostgreSQL 14 now has a growing list of commands that have a "progress bar" – in other words, they provide information to show intermediate progress information for active commands.
Getting ready
Using the earlier recipes, identify the active processes that concern you:
SELECT pid, query FROM pg_stat_activity WHERE state = 'active';
If the query
 column indicates that they are one of the following actions, then we can look at detailed progress information for them:
- Maintenance commands:
ANALYZE
,VACUUM
,VACUUM
FULL
/CLUSTER
- Index commands:
CREATE
INDEX
,REINDEX
- Backup/replication:
BASE
BACKUP
- Data load/unload:
COPY
At this time, SELECT
statements don't provide detailed progress information.
How to do it…
Each type of command has specific progress information, so you must look in the view that's appropriate to the type of command.
All commands show...