pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Cc: Yuzuko <yuzukohosoya@gmail.com>
Subject: Re: pgsql: autovacuum: handle analyze for partitioned tables
Date: Fri, 9 Apr 2021 17:31:55 -0400
Message-ID: <20210409213155.GA23912@alvherre.pgsql> (raw)
In-Reply-To: <CA+TgmoaVOx7K0BE8xpR=_FwLGEP1kJoSx+oskCsVGmuJq5h4vw@mail.gmail.com>

On 2021-Apr-09, Robert Haas wrote:

> Does this need to worry about new partitions getting attached to a
> partitioned table, or old ones getting detached? (Maybe it does
> already, not sure.)

Good question.  It does not.

I suppose you could just let that happen automatically -- I mean, next
time the partitioned table is analyzed, it'll scan all attached
partitions.  But if no tuples are modified afterwards in existing
partitions (a common scenario), and the newly attached partition
contains lots of rows, then only future rows in the newly attached
partition would affect the stats of the partitioned table, and it could
be a long time before that causes an analyze on the partitioned table to
occur.

Maybe a way to attack this is to send a the "anl_ancestors" message to
the collector on attach and detach, adding a new flag ("is
attach/detach"), which indicates to add not only "changes_since_analyze
- changes_since_analyze_reported", but also "n_live_tuples".

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
Essentially, you're proposing Kevlar shoes as a solution for the problem
that you want to walk around carrying a loaded gun aimed at your foot.
(Tom Lane)





view thread (33+ messages)  latest in thread

Message-ID: <20210409213155.GA23912@alvherre.pgsql>
Permalink:  ../20210409213155.GA23912@alvherre.pgsql/
Also on:    postgresql.org/message-id/20210409213155.GA23912@alvherre.pgsql

 · 

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: alvherre@alvh.no-ip.org, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, zyu@yugabyte.com, pgsql-hackers@lists.postgresql.org, yuzukohosoya@gmail.com
  Subject: Re: pgsql: autovacuum: handle analyze for partitioned tables
  In-Reply-To: <20210409213155.GA23912@alvherre.pgsql>

* 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