ANALYZE command progress checker

From: vinayak <Pokale_Vinayak_q3(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: ANALYZE command progress checker
Date: 2017-02-28 09:24:57
Message-ID: c1691d3a-5b8f-ba1a-105a-3d3ef33f36ce@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Attachment Content-Type Size
pg_stat_progress_analyze_v1.patch binary/octet-stream 12.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Seki, Eiji 2017-02-28 09:54:17 [Doc fix] Wrong explanation about tsquery_phrase
Previous Message Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= 2017-02-28 09:12:51 Re: timeouts in PostgresNode::psql