public inbox for [email protected]
help / color / mirror / Atom feedFrom: Christophe Pettus <[email protected]>
To: Michael Harris <[email protected]>
Cc: [email protected]
Subject: Re: ANALYZE on partitioned tables vs on individual partitions
Date: Tue, 6 Aug 2024 21:43:35 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CADofcAXVbD0yGp_EaC9chmzsOoSai3jcfBCnyva3j0RRdRvMVA@mail.gmail.com>
References: <CADofcAXVbD0yGp_EaC9chmzsOoSai3jcfBCnyva3j0RRdRvMVA@mail.gmail.com>
> On Aug 6, 2024, at 21:13, Michael Harris <[email protected]> wrote:
>
> 1. What is the consequence of not having good statistics on partitioned table level, if you do have good statistics on the partition level?
The child partitions are just tables, and all of the same issues that can arise from bad statistics on a table can arise on them: specifically, bad query plans. (There are also some consequences to leaving a table unvacuumed, even an append-only table.) The root table in declarative partitioning has no rows, so there really is no such thing as "statistics at the partition level."
> 2. Which planning operations rely on partitioned table level statistics?
Just about every query uses the information that ANALYZE gathers in some way. If the query can't be executed in any other conceivable way than a sequential scan, or if it is a simple lookup on a unique column, the statistics will not contribute to the plan, but essentially every other plan will use them in one way or another.
Child partitions should be autovacuumed and autoanalyzed just like any other table; they are not prohibited from autovacuum in any way by default. It's probably a good idea to investigate why they are not being picked up by autovacuum. If they are created by a bulk load process, it's not a bad idea to do a VACUUM ANALYZE on them once the bulk load is complete.
view thread (2+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: ANALYZE on partitioned tables vs on individual partitions
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox