Hello Hackers, Following is a proposal for reporting the progress of ANALYZE command:
It seems that the following could be the phases of ANALYZE processing: 1. Collecting sample rows 2. Collecting inherited sample rows 3. Computing heap stats 4. Computing index stats 5. Cleaning up indexesThe first phase is easy if there is no inheritance but in case of inheritance we need to sample the blocks from multiple heaps.
Here the progress is counted against total number of blocks processed.The view provides the information of analyze command progress details as follows
postgres=# \d pg_stat_progress_analyze View "pg_catalog.pg_stat_progress_analyze" Column | Type | Collation | Nullable | Default -------------------+---------+-----------+----------+--------- pid | integer | | | datid | oid | | | datname | name | | | relid | oid | | | phase | text | | | heap_blks_total | bigint | | | heap_blks_scanned | bigint | | | total_sample_rows | bigint | | |I feel this view information may be useful in checking the progress of long running ANALYZE command.
The attached patch reports the different phases of analyze command. Added this patch to CF 2017-03. Opinions?Note: Collecting inherited sample rows phase is not reported yet in the patch.
Regards, Vinayak Pokale NTT Open Source Software Center
-- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers