From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com> |
Cc: | yuzuko <yuzukohosoya(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Greg Stark <stark(at)mit(dot)edu> |
Subject: | Re: Autovacuum on partitioned table |
Date: | 2020-02-21 08:35:07 |
Message-ID: | CA+HiwqEG+gv5oxuP+Rg4ruYz1u4ab7d_Sbzbb6R0p=ScfoG6qw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Feb 21, 2020 at 4:47 PM Masahiko Sawada
<masahiko(dot)sawada(at)2ndquadrant(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2020-02-21 08:37:15 | Re: [Patch] Make pg_checksums skip foreign tablespace directories |
Previous Message | Kyotaro Horiguchi | 2020-02-21 08:05:07 | Re: pg_regress cleans up tablespace twice. |