From a166d408eb0b35023c169e765f4664c3b114b52e Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 15 Jan 2020 11:02:09 -0300 Subject: Report progress of ANALYZE commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This uses the progress reporting infrastructure added by c16dc1aca5e0, adding support for ANALYZE. Co-authored-by: Álvaro Herrera Co-authored-by: Tatsuro Yamada Reviewed-by: Julien Rouhaud, Robert Haas, Anthony Nowocien, Kyotaro Horiguchi, Vignesh C, Amit Langote --- doc/src/sgml/monitoring.sgml | 188 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 185 insertions(+), 3 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 136778cb8ab..0bfd6151c47 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -344,6 +344,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser + + pg_stat_progress_analyzepg_stat_progress_analyze + One row for each backend (including autovacuum worker processes) running + ANALYZE, showing current progress. + See . + + + pg_stat_progress_create_indexpg_stat_progress_create_index One row for each backend running CREATE INDEX or REINDEX, showing @@ -3505,11 +3513,185 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, PostgreSQL has the ability to report the progress of certain commands during command execution. Currently, the only commands - which support progress reporting are CREATE INDEX, - VACUUM and - CLUSTER. This may be expanded in the future. + which support progress reporting are ANALYZE, + CLUSTER, + CREATE INDEX, and VACUUM. + This may be expanded in the future. + + + + ANALYZE Progress Reporting + + + Whenever ANALYZE is running, the + pg_stat_progress_analyze view will contain a + row for each backend that is currently running that command. The tables + below describe the information that will be reported and provide + information about how to interpret it. + + <structname>pg_stat_progress_analyze</structname> View + + + + Column + Type + Description + + + + + + pid + integer + Process ID of backend. + + + datid + oid + OID of the database to which this backend is connected. + + + datname + name + Name of the database to which this backend is connected. + + + relid + oid + OID of the table being analyzed. + + + phase + text + Current processing phase. See . + + + sample_blks_total + bigint + + Total number of heap blocks that will be sampled. + + + + sample_blks_scanned + bigint + + Number of heap blocks scanned. + + + + ext_stats_total + bigint + + Number of extended statistics. + + + + ext_stats_computed + bigint + + Number of computed extended statistics computed. This counter only advances when + the phase is computing extended statistics. + + + + child_tables_total + bigint + + Number of child tables. + + + + child_tables_done + bigint + + Number of child tables scanned. This counter only advances when the phase + is acquiring inherited sample rows. + + + + current_child_table_relid + oid + OID of the child table currently being scanned. This field is only valid when + the phase is computing extended statistics. + + + + +
+ + + ANALYZE phases + + + + Phase + Description + + + + + initializing + + The command is preparing to begin scanning the heap. This phase is + expected to be very brief. + + + + acquiring sample rows + + The command is currently scanning the table given by + current_relid to obtain sample rows. + + + + acquiring inherited sample rows + + The command is currently scanning child tables to obtain sample rows. Columns + child_tables_total, + child_tables_done, and + current_child_table_relid contain the progress + information for this phase. + + + + computing statistics + + The command is computing statistics from the samples rows obtained during + the table scan. + + + + computing extended statistics + + The command is computing extended statistics from the samples rows obtained + durring the table scan. + + + + finalizing analyze + + The command is updating pg_class. When this phase is completed, + ANALYZE will end. + + + + +
+ + + + Note that when ANALYZE is run on a partitioned table, + all of its partitions are also recursively analyzed as also mentioned on + . In that case, ANALYZE + progress is reported first for the parent table, whereby its inheritance + statistics are collected, followed by that for each partition. + + +
+ CREATE INDEX Progress Reporting -- cgit v1.2.3