pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add ONLY support for VACUUM and ANALYZE
Date: Tue, 24 Sep 2024 06:04:21 +0000
Message-ID: <E1ssyeq-000e41-ON@gemulon.postgresql.org> (raw)

Add ONLY support for VACUUM and ANALYZE

Since autovacuum does not trigger an ANALYZE for partitioned tables,
users must perform these manually.  However, performing a manual ANALYZE
on a partitioned table would always result in recursively analyzing each
partition and that could be undesirable as autovacuum takes care of that.
For partitioned tables that contain a large number of partitions, having
to analyze each partition could take an unreasonably long time, especially
so for tables with a large number of columns.

Here we allow the ONLY keyword to prefix the name of the table to allow
users to have ANALYZE skip processing partitions.  This option can also
be used with VACUUM, but there is no work to do if VACUUM ONLY is used on
a partitioned table.

This commit also changes the behavior of VACUUM and ANALYZE for
inheritance parents.  Previously inheritance child tables would not be
processed when operating on the parent.  Now, by default we *do* operate
on the child tables.  ONLY can be used to obtain the old behavior.
The release notes should note this as an incompatibility.  The default
behavior has not changed for partitioned tables as these always
recursively processed the partitions.

Author: Michael Harris <harmic@gmail.com>
Discussion: https://postgr.es/m/CADofcAWATx_haD=QkSxHbnTsAe6+e0Aw8Eh4H8cXyogGvn_kOg@mail.gmail.com
Discussion: https://postgr.es/m/CADofcAXVbD0yGp_EaC9chmzsOoSai3jcfBCnyva3j0RRdRvMVA@mail.gmail.com
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Melih Mutlu <m.melihmutlu@gmail.com>
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/62ddf7ee9a399e0b9624412fc482ed7365e38958

Modified Files
--------------
doc/src/sgml/ddl.sgml                | 23 +++++----
doc/src/sgml/monitoring.sgml         |  6 +--
doc/src/sgml/ref/analyze.sgml        | 36 +++++++-------
doc/src/sgml/ref/vacuum.sgml         | 11 +++--
src/backend/commands/vacuum.c        | 39 ++++++++++-----
src/backend/parser/gram.y            |  2 +-
src/test/regress/expected/vacuum.out | 92 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/vacuum.sql      | 66 ++++++++++++++++++++++++++
8 files changed, 230 insertions(+), 45 deletions(-)



Message-ID: <E1ssyeq-000e41-ON@gemulon.postgresql.org>
Permalink:  ../E1ssyeq-000e41-ON@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ssyeq-000e41-ON@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add ONLY support for VACUUM and ANALYZE
  In-Reply-To: <E1ssyeq-000e41-ON@gemulon.postgresql.org>

* 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