[HACKERS] ANALYZE command progress checker - Mailing list pgsql-hackers

From vinayak
Subject [HACKERS] ANALYZE command progress checker
Date
Msg-id c1691d3a-5b8f-ba1a-105a-3d3ef33f36ce@lab.ntt.co.jp
Whole thread Raw
Responses Re: [HACKERS] ANALYZE command progress checker  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Re: [HACKERS] ANALYZE command progress checker  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
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 indexes

The 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 (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Date:
Subject: Re: [HACKERS] timeouts in PostgresNode::psql
Next
From: "Seki, Eiji"
Date:
Subject: [HACKERS] [Doc fix] Wrong explanation about tsquery_phrase