From: Justin Pryzby <pryzby@telsasoft.com>
To: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: yuzuko <yuzukohosoya@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: David Steele <david@pgmasters.net>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-hackers@lists.postgresql.org, Greg Stark <stark@mit.edu>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: Andrew Dunstan <andrew@dunslane.net>
Subject: Re: Autovacuum on partitioned table (autoanalyze)
Date: Wed, 25 Aug 2021 14:29:51 -0500
Message-ID: <20210825192951.GD10479@telsasoft.com> (raw)
In-Reply-To: <20210820125513.GQ10479@telsasoft.com>
References: <202108161546.3zuouk76skr4@alvherre.pgsql>
<202108162142.crk2myigb2ad@alvherre.pgsql>
<20210816222810.GE10479@telsasoft.com>
<20210817113018.GG10479@telsasoft.com>
<20210820125513.GQ10479@telsasoft.com>
On Fri, Aug 20, 2021 at 07:55:13AM -0500, Justin Pryzby wrote:
> On Tue, Aug 17, 2021 at 06:30:18AM -0500, Justin Pryzby wrote:
> > On Mon, Aug 16, 2021 at 05:28:10PM -0500, Justin Pryzby wrote:
> > > 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
> >
> > I suggest the attached (which partially reverts the revert), to allow showing
> > correct data for analyze_count and last_analyzed.
>
> Álvaro, would you comment on this ?
>
> To me this could be an open item, but someone else should make that
> determination.
I added an opened item until this is discussed.
| pg_stats includes partitioned tables, but always shows analyze_count=0
| Owner: Alvaro Herrera
Possible solutions, in decreasing order of my own preference:
- partially revert the revert, as proposed, to have "analyze_count" and
"last_analyzed" work properly for partitioned tables. This doesn't suffer
from any of the problems that led to the revert, does it ?
- Update the .c code to return analyze_count=NULL for partitioned tables.
- Update the catalog definition to exclude partitioned tables, again.
Requires a catalog bumped.
- Document that analyze_count=NULL for partitioned tables. It seems to just
document a misbehavior.
--
Justin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, alvherre@alvh.no-ip.org, andres@anarazel.de, horiguchi.kyotaro@lab.ntt.co.jp, yuzukohosoya@gmail.com, tomas.vondra@enterprisedb.com, david@pgmasters.net, horikyota.ntt@gmail.com, daniel@yesql.se, amitlangote09@gmail.com, masahiko.sawada@2ndquadrant.com, laurenz.albe@cybertec.at, stark@mit.edu, michael@paquier.xyz, pg@bowt.ie, andrew@dunslane.net
Subject: Re: Autovacuum on partitioned table (autoanalyze)
In-Reply-To: <20210825192951.GD10479@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox