Re: Autovacuum on partitioned table (autoanalyze)

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>, yuzuko <yuzukohosoya@gmail.com>, Tomas Vondra <tomas.vondra@enterprisedb.com>, David Steele <david@pgmasters.net>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Daniel Gustafsson <daniel@yesql.se>, Amit Langote <amitlangote09@gmail.com>, Masahiko Sawada <masahiko.sawada@2ndquadrant.com>, Laurenz Albe <laurenz.albe@cybertec.at>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Greg Stark <stark@mit.edu>
Date: 2021-08-16T22:28:10Z
Lists: pgsql-hackers
On Mon, Aug 16, 2021 at 05:42:48PM -0400, Álvaro Herrera wrote:
> On 2021-Aug-16, Álvaro Herrera wrote:
> 
> > Here's the reversal patch for the 14 branch.  (It applies cleanly to
> > master, but the unused member of PgStat_StatTabEntry needs to be
> > removed and catversion bumped).
> 
> I have pushed this to both branches.  (I did not remove the item from
> the release notes in the 14 branch.)

|    I retained the addition of relkind 'p' to tables included by
|    pg_stat_user_tables, because reverting that would require a catversion
|    bump.

Right now, on v15dev, it shows 0, which is misleading.
Shouldn't it be null ?

analyze_count       | 0

Note that having analyze_count and last_analyze would be an an independently
useful change.  Since parent tables aren't analyzed automatically, I have a
script to periodically process them if they weren't processed recently.  Right
now, for partitioned tables, the best I could find is to check its partitions:
| MIN(last_analyzed) FROM pg_stat_all_tables psat JOIN pg_inherits i ON psat.relid=i.inhrelid

In 20200418050815.GE26953@telsasoft.com I wrote:
|This patch includes partitioned tables in pg_stat_*_tables, which is great; I
|complained awhile ago that they were missing [0].  It might be useful if that
|part was split out into a separate 0001 patch (?).
| [0] https://www.postgresql.org/message-id/20180601221428.GU5164%40telsasoft.com

-- 
Justin



Commits

  1. Keep stats up to date for partitioned tables

  2. Revert analyze support for partitioned tables

  3. Document ANALYZE storage parameters for partitioned tables

  4. autovacuum: handle analyze for partitioned tables