Re: Autovacuum on partitioned table - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Autovacuum on partitioned table
Date
Msg-id CA+HiwqEG+gv5oxuP+Rg4ruYz1u4ab7d_Sbzbb6R0p=ScfoG6qw@mail.gmail.com
Whole thread Raw
In response to Re: Autovacuum on partitioned table  (Masahiko Sawada <masahiko.sawada@2ndquadrant.com>)
Responses Re: Autovacuum on partitioned table
List pgsql-hackers
On Fri, Feb 21, 2020 at 4:47 PM Masahiko Sawada
<masahiko.sawada@2ndquadrant.com> wrote:
> Thank you for updating the patch. I tested v4 patch.
>
> After analyze or autoanalyze on partitioned table n_live_tup and
> n_dead_tup are updated. However, TRUNCATE and VACUUM on the
> partitioned table don't change these values until invoking analyze or
> autoanalyze whereas in normal tables these values are reset or
> changed. For example, with your patch:
>
> * Before
>  relname | n_live_tup | n_dead_tup | n_mod_since_analyze
> ---------+------------+------------+---------------------
>  c1      |         11 |          0 |                   0
>  c2      |         11 |          0 |                   0
>  c3      |         11 |          0 |                   0
>  c4      |         11 |          0 |                   0
>  c5      |         11 |          0 |                   0
>  parent  |         55 |          0 |                   0
> (6 rows)
>
> * After 'TRUNCATE parent'
>  relname | n_live_tup | n_dead_tup | n_mod_since_analyze
> ---------+------------+------------+---------------------
>  c1      |          0 |          0 |                   0
>  c2      |          0 |          0 |                   0
>  c3      |          0 |          0 |                   0
>  c4      |          0 |          0 |                   0
>  c5      |          0 |          0 |                   0
>  parent  |         55 |          0 |                   0
> (6 rows)
>
> * Before
>  relname | n_live_tup | n_dead_tup | n_mod_since_analyze
> ---------+------------+------------+---------------------
>  c1      |          0 |         11 |                   0
>  c2      |          0 |         11 |                   0
>  c3      |          0 |         11 |                   0
>  c4      |          0 |         11 |                   0
>  c5      |          0 |         11 |                   0
>  parent  |          0 |         55 |                   0
> (6 rows)
>
> * After 'VACUUM parent'
>  relname | n_live_tup | n_dead_tup | n_mod_since_analyze
> ---------+------------+------------+---------------------
>  c1      |          0 |          0 |                   0
>  c2      |          0 |          0 |                   0
>  c3      |          0 |          0 |                   0
>  c4      |          0 |          0 |                   0
>  c5      |          0 |          0 |                   0
>  parent  |          0 |         55 |                   0
> (6 rows)
>
> We can make it work correctly but I think perhaps we can skip updating
> statistics values of partitioned tables other than n_mod_since_analyze
> as the first step. Because if we support also n_live_tup and
> n_dead_tup, user might get confused that other statistics values such
> as seq_scan, seq_tup_read however are not supported.

+1, that makes sense.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: pg_regress cleans up tablespace twice.
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: [Patch] Make pg_checksums skip foreign tablespace directories