Re: progress report for ANALYZE

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: progress report for ANALYZE
Date: 2019-11-29 09:15:28
Message-ID: CA+HiwqEHBiqFyY1_GnqG_6mYTXufMxrrCZhmXUNNeTM7WYkyOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yamada-san,

On Fri, Nov 29, 2019 at 5:45 PM Tatsuro Yamada
<tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2019-11-29 09:16:00 Re: Implementing Incremental View Maintenance
Previous Message Tatsuro Yamada 2019-11-29 08:45:14 Re: progress report for ANALYZE