Re: VACUUM FULL, CLUSTER, and REPACK block on other sessions' temp tables

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Antonin Houska <ah(at)cybertec(dot)at>
Subject: Re: VACUUM FULL, CLUSTER, and REPACK block on other sessions' temp tables
Date: 2026-03-25 23:00:02
Message-ID: 9de2a59f-9597-4101-bf34-cf3804752e64@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

On 25/03/2026 21:38, Zsolt Parragi wrote:
> Shouldn't the patch also include a tap test to verify that the change
> works / fails without it?

Definitely. I just didn't want to invest much time on tests before
getting feedback on the issue itself.

> + /* Skip temp relations belonging to other sessions */
> + {
> + Oid nsp = get_rel_namespace(index->indrelid);
> +
> + if (!isTempOrTempToastNamespace(nsp) && isAnyTempNamespace(nsp))
> + {
>
> Doesn't this result in several repeated syscache lookups?
>
> There's already a SearchSysCacheExsists1 directly above this, then a
> get_rel_namespace, then an isAnyTempNamespace. While this probably
> isn't performance critical, this should be doable with a single
> SearchSysCache1(RELOID...) and then a few conditions, similarly to the
> else branch below this?

You're right. Although it is not performance critical we can solve it
with a single SearchSysCache1.

PFA v3 with the improved fix (0001) and tests (0002).

Thanks for the review!

Best, Jim

Attachment Content-Type Size
v3-0001-Skip-other-sessions-temp-tables-in-REPACK-CLUSTER.patch text/x-patch 3.7 KB
v3-0002-Test-VACUUM-FULL-CLUSTER-and-REPACK-with-locked-t.patch text/x-patch 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-03-25 23:06:20 Re: Adding locks statistics
Previous Message Masahiko Sawada 2026-03-25 22:42:30 Re: POC: Parallel processing of indexes in autovacuum