Re: pgsql: autovacuum: handle analyze for partitioned tables

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Zhihong Yu <zyu(at)yugabyte(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Yuzuko <yuzukohosoya(at)gmail(dot)com>
Subject: Re: pgsql: autovacuum: handle analyze for partitioned tables
Date: 2021-04-09 21:53:08
Message-ID: ee587b50-757e-a2e4-15a9-5a74f5f92cd1@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 4/9/21 11:45 PM, Justin Pryzby wrote:
> On Fri, Apr 09, 2021 at 05:31:55PM -0400, Alvaro Herrera wrote:
>> 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 think there's probably cases where this is desirable, and cases where it's
> undesirable, so I don't think it's necessarily a problem.
>
> One data point: we do DETACH/ATTACH tables during normal operation, before
> type-promoting ALTERs, to avoid worst-case disk use, and to avoid locking the
> table for a long time. It'd be undesirable (but maybe of no great consequence)
> to trigger an ALTER when we DETACH them, since we'll re-ATTACH it shortly
> afterwards.
>
> However, I think DROP should be handled ?
>

IMHO we should prefer the default behavior which favors having updated
statistics, and maybe have a way to override it for individual commands.
So ATTACH would update changes_since_analyze by default, but it would be
possible to disable that.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2021-04-09 22:16:59 Re: pgsql: autovacuum: handle analyze for partitioned tables
Previous Message Justin Pryzby 2021-04-09 21:45:08 Re: pgsql: autovacuum: handle analyze for partitioned tables

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-04-09 22:16:59 Re: pgsql: autovacuum: handle analyze for partitioned tables
Previous Message Justin Pryzby 2021-04-09 21:45:08 Re: pgsql: autovacuum: handle analyze for partitioned tables