pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: yuzuko <yuzukohosoya@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Greg Stark <stark@mit.edu>
Subject: Re: Autovacuum on partitioned table
Date: Mon, 02 Dec 2019 10:19:01 +0100
Message-ID: <fdc0cd8f903066d42132faca60cd8dbf3f8fa09e.camel@cybertec.at> (raw)
In-Reply-To: <CAKkQ508_PwVgwJyBY=0Lmkz90j8CmWNPUxgHvCUwGhMrouz6UA@mail.gmail.com>
References: <CAKkQ508_PwVgwJyBY=0Lmkz90j8CmWNPUxgHvCUwGhMrouz6UA@mail.gmail.com>

On Mon, 2019-12-02 at 18:02 +0900, yuzuko wrote:
> Greg reported in [1] before, autovacuum ignores partitioned tables.
> That is, even if individual partitions’ statistics are updated, its parent's
> statistics are not updated.  This is TODO for declarative partitioning.
> As Amit mentioned in [2], a way to make parent's statistics from
> partitions' statistics without scanning the partitions would be nice,
> but it will need a lot of modifications.  So I tried to fix that using the
> current analyze method.
> 
> The summary of the attached patch is as follows:
> * If the relation is a partitioned table, check its children if they need
>   vacuum or analyze.  Children need to do that are added to
>   a table list for autovacuuum.  At least one child is added to the list,
>   the partitioned table is also added to the list.  Then, autovacuum
>   runs on all the tables in the list.

That means that all partitions are vacuumed if only one of them needs it,
right?  This will result in way more vacuuming than necessary.

Wouldn't it be an option to update the partitioned table's statistics
whenever one of the partitions is vacuumed?

Yours,
Laurenz Albe






view thread (28+ messages)  latest in thread

Message-ID: <fdc0cd8f903066d42132faca60cd8dbf3f8fa09e.camel@cybertec.at>
Permalink:  ../fdc0cd8f903066d42132faca60cd8dbf3f8fa09e.camel@cybertec.at/
Also on:    postgresql.org/message-id/fdc0cd8f903066d42132faca60cd8dbf3f8fa09e.camel@cybertec.at

 · 

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-hackers@postgresql.org
  Cc: laurenz.albe@cybertec.at, yuzukohosoya@gmail.com, pgsql-hackers@lists.postgresql.org, stark@mit.edu
  Subject: Re: Autovacuum on partitioned table
  In-Reply-To: <fdc0cd8f903066d42132faca60cd8dbf3f8fa09e.camel@cybertec.at>

* 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