Re: Autovacuum on partitioned table (autoanalyze) - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Autovacuum on partitioned table (autoanalyze)
Date
Msg-id 20201130175709.GA30970@alvherre.pgsql
Whole thread Raw
In response to Re: Autovacuum on partitioned table (autoanalyze)  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Autovacuum on partitioned table (autoanalyze)  (yuzuko <yuzukohosoya@gmail.com>)
List pgsql-hackers
On 2020-Nov-10, Kyotaro Horiguchi wrote:

> In second thought about the reason for the "toprel_oid". It is perhaps
> to avoid "wrongly" propagated values to ancestors after a manual
> ANALYZE on a partitioned table.  But the same happens after an
> autoanalyze iteration if some of the ancestors of a leaf relation are
> analyzed before the leaf relation in a autoanalyze iteration.  That
> can trigger an unnecessary analyzing for some of the ancestors.

I'm not sure I understand this point.  I think we should only trigger
this on analyzes of *leaf* partitions, not intermediate partitioned
relations.  That way you would never get these unnecesary analyzes.
Am I missing something?

(So with my proposal in the previous email, we would send the list of
ancestor relations after analyzing a leaf partition.  Whenever we
analyze a non-leaf, then the list of ancestors is sent as an empty
list.)

> > > Regarding the counters in pg_stat_all_tables: maybe some of these should be
> > > null rather than zero ?  Or else you should make an 0001 patch to fully
> > > implement this view, with all relevant counters, not just n_mod_since_analyze,
> > > last_*analyze, and *analyze_count.  These are specifically misleading:
> > >
> > > last_vacuum         |
> > > last_autovacuum     |
> > > n_ins_since_vacuum  | 0
> > > vacuum_count        | 0
> > > autovacuum_count    | 0
> > >
> > I haven't modified this part yet, but you meant that we should set
> > null to counters
> > about vacuum because partitioned tables are not vacuumed?
> 
> Perhaps bacause partitioned tables *cannot* be vacuumed.  I'm not sure
> what is the best way here.  Showing null seems reasonable but I'm not
> sure that doesn't break anything.

I agree that showing NULLs for the vacuum columns is better.  Perhaps
the most reasonable way to do this is use -1 as an indicator that NULL
ought to be returned from pg_stat_get_vacuum_count() et al, and add a
boolean in PgStat_TableCounts next to t_truncated, maybe "t_nullvacuum"
that says to store -1 instead of 0 in pgstat_recv_tabstat.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cost overestimation of foreign JOIN
Next
From: Fujii Masao
Date:
Subject: Re: Add Information during standby recovery conflicts