Re: [PATCH] VACUUM: avoid pre-creation transactions holding back cleanup of newly created relations

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Mikhail Kharitonov <mikhail(dot)kharitonov(dot)dev(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] VACUUM: avoid pre-creation transactions holding back cleanup of newly created relations
Date: 2025-12-09 19:31:09
Message-ID: CAAKRu_YqAgs8A5-TcKcGU1XsRE3ZC5VGmgF3YZuvQgq5V_fBZQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 9, 2025 at 2:25 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Isn't the whole idea that it would be safe to allow freezing in this case
> incorrect? Consider the following scenario:
>
> A1: BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ; SELECT;
> B1: CREATE TABLE foo AS SELECT random();
> B2: VACUUM FREEZE foo;
> A2: SELECT * FROM foo;
>
> If you allowed freezing of the rows in B2, A2 will see the rows as visible,
> despite them not being supposed to be visible.

Is the reason this isn't a problem for COPY FREEZE because the
freezing happens in the same transaction block as creating the table
so A2 wouldn't be able to see the catalog entry for the table?

- Melanie

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-12-09 19:34:43 Re: pg_plan_advice
Previous Message Andres Freund 2025-12-09 19:25:44 Re: [PATCH] VACUUM: avoid pre-creation transactions holding back cleanup of newly created relations