Re: Global temporary tables - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Global temporary tables
Date
Msg-id CAEZATCVWnhKLz2NyfwShyNrHP1QyVhL_9YUFHB8EhcZeQKvRDw@mail.gmail.com
Whole thread
In response to Re: Global temporary tables  (Japin Li <japinli@hotmail.com>)
List pgsql-hackers
On Wed, 1 Jul 2026 at 07:24, Japin Li <japinli@hotmail.com> wrote:
>
> Thanks for working on this.

Thank you for testing it!

> While testing the v5 patch, I encountered a lock wait.
>
> 2026-07-01 14:18:43.603 CST [1486593] LOG:  process 1486593 still waiting for AccessExclusiveLock on relation 16384
ofdatabase 5 after 1000.106 ms
 
> 2026-07-01 14:18:43.603 CST [1486593] DETAIL:  Process holding the lock: 1486484. Wait queue: 1486593.
> 2026-07-01 14:18:43.603 CST [1486593] CONTEXT:  waiting for AccessExclusiveLock on relation 16384 of database 5
> 2026-07-01 14:18:43.603 CST [1486593] STATEMENT:  SELECT * FROM gtt_delete;
>
> Is this expected?

Ah yes, you're right. That's not good.

The root cause looks to be the same issue that Pavel reported -- the
ON COMMIT DELETE ROWS does a TRUNCATE when the transaction is
committed, which requires an AccessExclusiveLock. I think the patch
should reduce the lock level required for TRUNCATE on a global
temporary relation to RowExclusiveLock, like DELETE.

I'll try to post an update later this week.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Global temporary tables
Next
From: shveta malik
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication