Yamada-san, On Fri, Nov 29, 2019 at 5:45 PM Tatsuro Yamada <tatsuro.yamada...@nttcom.co.jp> wrote: > 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. > 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, Amit