From 03f9e5cba0ee1633af4abe734504df50af46fbd8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 7 Apr 2019 11:30:14 +0200 Subject: Report progress of REINDEX operations This uses the same infrastructure that the CREATE INDEX progress reporting uses. Add a column to pg_stat_progress_create_index to report the OID of the index being worked on. This was not necessary for CREATE INDEX, but it's useful for REINDEX. Also edit the phase descriptions a bit to be more consistent with the source code comments. Discussion: https://www.postgresql.org/message-id/ef6a6757-c36a-9e81-123f-13b19e36b7d7%402ndquadrant.com --- doc/src/sgml/monitoring.sgml | 50 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index c5853da7af0..4eb43f2de95 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -346,7 +346,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_progress_create_indexpg_stat_progress_create_index - One row for each backend running CREATE INDEX, showing + One row for each backend running CREATE INDEX or REINDEX, showing current progress. See . @@ -3477,7 +3477,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, CREATE INDEX Progress Reporting - Whenever CREATE INDEX is running, the + Whenever CREATE INDEX or REINDEX is running, the pg_stat_progress_create_index view will contain one row for each backend that is currently creating indexes. The tables below describe the information that will be reported and provide information @@ -3516,6 +3516,12 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, oid OID of the table on which the index is being created. + + index_relid + oid + OID of the index being created or reindexed. During a + non-concurrent CREATE INDEX, this is 0. + phase text @@ -3605,15 +3611,15 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, initializing - CREATE INDEX is preparing to create the index. This + CREATE INDEX or REINDEX is preparing to create the index. This phase is expected to be very brief. - waiting for old snapshots + waiting for writers before build - CREATE INDEX CONCURRENTLY is waiting for transactions - that can potentially see the table to release their snapshots. + CREATE INDEX CONCURRENTLY or REINDEX CONCURRENTLY is waiting for transactions + with write locks that can potentially see the table to finish. This phase is skipped when not in concurrent mode. Columns lockers_total, lockers_done and current_locker_pid contain the progress @@ -3632,10 +3638,10 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, - waiting for writer snapshots + waiting for writers before validation - CREATE INDEX CONCURRENTLY is waiting for transactions - that can potentially write into the table to release their snapshots. + CREATE INDEX CONCURRENTLY or REINDEX CONCURRENTLY is waiting for transactions + with write locks that can potentially write into the table to finish. This phase is skipped when not in concurrent mode. Columns lockers_total, lockers_done and current_locker_pid contain the progress @@ -3670,9 +3676,9 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, - waiting for reader snapshots + waiting for old snapshots - CREATE INDEX CONCURRENTLY is waiting for transactions + CREATE INDEX CONCURRENTLY or REINDEX CONCURRENTLY is waiting for transactions that can potentially see the table to release their snapshots. This phase is skipped when not in concurrent mode. Columns lockers_total, lockers_done @@ -3680,6 +3686,28 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, information for this phase. + + waiting for readers before marking dead + + REINDEX CONCURRENTLY is waiting for transactions + with read locks on the table to finish, before marking the old index dead. + This phase is skipped when not in concurrent mode. + Columns lockers_total, lockers_done + and current_locker_pid contain the progress + information for this phase. + + + + waiting for readers before dropping + + REINDEX CONCURRENTLY is waiting for transactions + with read locks on the table to finish, before dropping the old index. + This phase is skipped when not in concurrent mode. + Columns lockers_total, lockers_done + and current_locker_pid contain the progress + information for this phase. + + -- cgit v1.2.3