From: Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: progress report for ANALYZE
Date: Wed, 04 Dec 2019 17:53:42 +0900
Message-ID: <269f26cd-d90c-5ede-e29c-fd58a44a6884@nttcom.co.jp_1> (raw)
In-Reply-To: <CA+HiwqEHBiqFyY1_GnqG_6mYTXufMxrrCZhmXUNNeTM7WYkyOQ@mail.gmail.com>
References: <20191128133717.GA22933@alvherre.pgsql>
<5331546a-7ec4-5539-6912-8c13829de1d8@nttcom.co.jp_1>
<afdbba1d-50ad-bc73-8f29-76e2b6e9d0cb@nttcom.co.jp_1>
<CA+HiwqEHBiqFyY1_GnqG_6mYTXufMxrrCZhmXUNNeTM7WYkyOQ@mail.gmail.com>
Hi Amit-san,
Thanks for your comments!
>> Attached patch is the revised patch. :)
>>
>> I wonder two things below. What do you think?
>>
>> 1)
>> For now, I'm not sure it should be set current_child_table_relid to zero
>> when the current phase is changed from "acquiring inherited sample rows" to
>> "computing stats". See <Test result> bellow.
>
> In the upthread discussion [1], Robert asked to *not* do such things,
> that is, resetting some values due to phase change. I'm not sure his
> point applies to this case too though.
Yeah, I understood.
I'll check target relid of "computing stats" to re-read a code of
analyze command later. :)
>> 2)
>> There are many "finalizing analyze" phases based on relids in the case
>> of partitioning tables. Would it better to fix the document? or it
>> would be better to reduce it to one?
>>
>> <Document>
>> ---------------------------------------------------------
>> <entry><literal>finalizing analyze</literal></entry>
>> <entry>
>> The command is updating pg_class. When this phase is completed,
>> <command>ANALYZE</command> will end.
>> ---------------------------------------------------------
>
> When a partitioned table is analyzed, its partitions are analyzed too.
> So, the ANALYZE command effectively runs N + 1 times if there are N
> partitions -- first analyze partitioned table to collect "inherited"
> statistics by collecting row samples using
> acquire_inherited_sample_rows(), then each partition to collect its
> own statistics. Note that this recursive application to ANALYZE to
> partitions (child tables) only occurs for partitioned tables, not for
> legacy inheritance.
Thanks for your explanation.
I understand Analyzing Partitioned table a little.
Below is my understanding. Is it right?
==================================================
In the case of partitioned table (N = 3)
- Partitioned table name: p (relid is 100)
- Partitioning table names: p1, p2, p3 (relids are 201, 202 and 203)
For now, We can get the following results by executing "analyze p;".
Num Phase relid current_child_table_relid
1 acquire inherited sample rows 100 201
2 acquire inherited sample rows 100 202
3 acquire inherited sample rows 100 203
4 computing stats 100 0
5 finalizing analyze 100 0
6 acquiring sample rows 201 0
7 computing stats 201 0
8 finalizing analyze 201 0
9 acquiring sample rows 202 0
10 computing stats 202 0
11 finalizing analyze 202 0
12 acquiring sample rows 203 0
13 computing stats 203 0
14 finalizing analyze 203 0
==================================================
Thanks,
Tatsuro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tatsuro.yamada.tf@nttcom.co.jp, amitlangote09@gmail.com, alvherre@2ndquadrant.com, vignesh21@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: progress report for ANALYZE
In-Reply-To: <269f26cd-d90c-5ede-e29c-fd58a44a6884@nttcom.co.jp_1>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox