Re: progress report for ANALYZE - Mailing list pgsql-hackers
From | Tatsuro Yamada |
---|---|
Subject | Re: progress report for ANALYZE |
Date | |
Msg-id | 269f26cd-d90c-5ede-e29c-fd58a44a6884@nttcom.co.jp_1 Whole thread Raw |
In response to | Re: progress report for ANALYZE (Amit Langote <amitlangote09@gmail.com>) |
Responses |
Re: progress report for ANALYZE
|
List | pgsql-hackers |
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
pgsql-hackers by date: