Re: pgsql: autovacuum: handle analyze for partitioned tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: autovacuum: handle analyze for partitioned tables
Date: 2021-04-08 18:47:01
Message-ID: 1910760.1617907621@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> On 2021-Apr-08, Tom Lane wrote:
>> Yeah. I hit this on another machine that isn't using EXEC_BACKEND,
>> and I concur it looks more like a race condition. I think the problem
>> is that autovacuum is calling find_all_inheritors() on a relation it
>> has no lock on, contrary to that function's API spec.

> Hmm. Autovacuum tries hard to avoid grabbing locks on relations until
> really needed (at vacuum/analyze time), which is why all these tests
> only use data that can be found in the pg_class rows and pgstat entries.

Yeah, I was worried about that.

> So I tend to think that my initial instinct was the better direction: we
> should not be doing any find_all_inheritors() here at all, but instead
> rely on pg_class.reltuples to be set for the partitioned table.

+1

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-04-08 19:14:32 pgsql: Suppress uninitialized-variable warning.
Previous Message Alvaro Herrera 2021-04-08 18:35:51 Re: pgsql: autovacuum: handle analyze for partitioned tables

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-04-08 18:58:04 Re: [HACKERS] Custom compression methods
Previous Message Alvaro Herrera 2021-04-08 18:35:51 Re: pgsql: autovacuum: handle analyze for partitioned tables