Re: Autovacuum on partitioned table (autoanalyze)

From: yuzuko <yuzukohosoya(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Amit Langote <amitlangote09(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(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 (autoanalyze)
Date: 2020-11-05 07:03:12
Message-ID: CAKkQ5087FZ6dRz+P4_Udx1doEDNsDZed0bUr7Vi+yGFQLc3Jmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Justin,

Thank you for your comments.
I attached the latest patch(v11) to the previous email.

>
> + * Get its all ancestors to propagate changes_since_analyze count.
> + * However, when ANALYZE inheritance tree, we get ancestors of
> + * toprel_oid to avoid needless counting.
>
> => I don't understand that comment.
>
I fixed that comment.

> + /* Find all members of inheritance set taking AccessShareLock */
> + children = find_all_inheritors(relid, AccessShareLock, NULL);
>
> => Do you know that returns the table itself ? And in pg14dev, each
> partitioned table has reltuples = -1, not zero...
>
> + /* Skip foreign partitions */
> + if (childclass->relkind == RELKIND_FOREIGN_TABLE)
> + continue;
>
> => Michael's suggrestion is to use RELKIND_HAS_STORAGE to skip both foreign and
> partitioned tables.
>
I overlooked that. Revised that according to your comments.

> Also, you called SearchSysCacheCopy1, but didn't free the tuple. I don't think
> you need to copy it anyway - just call ReleaseSysCache().
>
Fixed it.

> 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?

--
Best regards,
Yuzuko Hosoya
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-11-05 07:26:55 Re: Protect syscache from bloating with negative cache entries
Previous Message Michael Paquier 2020-11-05 06:41:23 Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2