pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: henri.chapelle@dbandmore.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17942: vacuumdb doesn't populate extended statistics on partitioned tables
Date: Fri, 26 May 2023 14:48:30 +0900
Message-ID: <ZHBILpg7K4ylJ8zl@paquier.xyz> (raw)
In-Reply-To: <20230526.091536.1662896499070434031.horikyota.ntt@gmail.com>
References: <17942-50aa28accc2e412c@postgresql.org>
	<20230525.130759.1771148055252912581.horikyota.ntt@gmail.com>
	<ZG8SLtCX0erW5Di7@paquier.xyz>
	<20230526.091536.1662896499070434031.horikyota.ntt@gmail.com>

On Fri, May 26, 2023 at 09:15:36AM +0900, Kyotaro Horiguchi wrote:
> It seems to be exactly the same as ANALYZE, though. I'm a bit unclear
> about our perspective on this SQL command's behavior.

Sorry for being a bit unclear here.  When dealing with partitioned
tables, a database-wide ANALYZE processes the partitions individually
as well as a full partition/inheritance tree.

My point is slightly different though: your suggestion of adding
RELKIND_PARTITIONED_TABLE to the filter added in vacuumdb would work
for -Z, but it would cause the vacuum code path of vacuumdb to process
more than once all the partitions in a single run.  For instance, take
this schema: 
CREATE TABLE parent_list (id int) PARTITION BY LIST (id);                                                                                                                  
CREATE TABLE child_list PARTITION OF parent_list
  FOR VALUES IN (1, 2);                                                                                                                                                  

`vacuumdb` would now list both parent_list and child_list, making
child_list being vacuumed twice, which is not necessary.  In order to
get a behavior in parity with the SQL commands ANALYZE, VACUUM and
VACUUM ANALYZE, we need to be more careful about the addition of
RELKIND_PARTITIONED_TABLE to the filtering clause.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (8+ messages)  latest in thread

Message-ID: <ZHBILpg7K4ylJ8zl@paquier.xyz>
Permalink:  ../ZHBILpg7K4ylJ8zl@paquier.xyz/
Also on:    postgresql.org/message-id/ZHBILpg7K4ylJ8zl@paquier.xyz

 · 

reply

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-bugs@postgresql.org
  Cc: michael@paquier.xyz, horikyota.ntt@gmail.com, henri.chapelle@dbandmore.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17942: vacuumdb doesn't populate extended statistics on partitioned tables
  In-Reply-To: <ZHBILpg7K4ylJ8zl@paquier.xyz>

* 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