From: Justin Pryzby <pryzby@telsasoft.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: yuzuko <yuzukohosoya@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: document the need to analyze partitioned tables
Date: Wed, 18 Jan 2023 11:49:19 -0600
Message-ID: <20230118174919.GA9837@telsasoft.com> (raw)
In-Reply-To: <fae7e128fd78965a1fa4dc9c571a9f5187d16f85.camel@cybertec.at>
References: <19c248d9-3687-9e0f-0b1a-2adad1de6fbe@enterprisedb.com>
<CA+TgmoYNaSWQg1W3JZ62UBM9iMphBpVJr_oDxn5T1X_viOPBtw@mail.gmail.com>
<20220315230011.GZ28503@telsasoft.com>
<88903179-5ce2-3d4d-af43-7830372bdcb6@enterprisedb.com>
<1fd81ddc7710a154834030133c6fea41e55c8efb.camel@cybertec.at>
<20230112232747.GA2111950@nathanxps13>
<Y8cKxCRXBwEVFfot@momjian.us>
<20230117210050.GX9837@telsasoft.com>
<Y8cQJIMFAe7QT73/@momjian.us>
<fae7e128fd78965a1fa4dc9c571a9f5187d16f85.camel@cybertec.at>
On Wed, Jan 18, 2023 at 10:15:18AM +0100, Laurenz Albe wrote:
> On Tue, 2023-01-17 at 16:16 -0500, Bruce Momjian wrote:
> > On Tue, Jan 17, 2023 at 03:00:50PM -0600, Justin Pryzby wrote:
> > > Maybe (all?) the clarification the docs need is to say:
> > > "Partitioned tables are not *themselves* processed by autovacuum."
> >
> > Yes, I think the lack of autovacuum needs to be specifically mentioned
> > since most people assume autovacuum handles _all_ statistics updating.
That's what 61fa6ca79 aimed to do. Laurenz is suggesting further
clarification.
> > Can someone summarize how bad it is we have no statistics on partitioned
> > tables? It sounds bad to me.
>
> Andrey Lepikhov had an example earlier in this thread[1]. It doesn't take
> an exotic query.
>
> Attached is a new version of my patch that tries to improve the wording.
I tweaked this a bit to end up with:
> - Partitioned tables are not processed by autovacuum. Statistics
> - should be collected by running a manual <command>ANALYZE</command> when it is
> + The leaf partitions of a partitioned table are normal tables and are processed
> + by autovacuum; however, autovacuum does not process the partitioned table itself.
> + This is no problem as far as <command>VACUUM</command> is concerned, since
> + there's no need to vacuum the empty, partitioned table. But, as mentioned in
> + <xref linkend="vacuum-for-statistics"/>, it also means that autovacuum won't
> + run <command>ANALYZE</command> on the partitioned table.
> + Although statistics are automatically gathered on its leaf partitions, some queries also need
> + statistics on the partitioned table to run optimally. You should collect statistics by
> + running a manual <command>ANALYZE</command> when the partitioned table is
> first populated, and again whenever the distribution of data in its
> partitions changes significantly.
> </para>
"partitions are normal tables" was techically wrong, as partitions can
also be partitioned.
--
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, laurenz.albe@cybertec.at, bruce@momjian.us, nathandbossart@gmail.com, tomas.vondra@enterprisedb.com, robertmhaas@gmail.com, alvherre@alvh.no-ip.org, yuzukohosoya@gmail.com
Subject: Re: document the need to analyze partitioned tables
In-Reply-To: <20230118174919.GA9837@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