| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
| Cc: | James Pang <jamespang886(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org |
| Subject: | Re: a lot of session wait on lock relation |
| Date: | 2025-05-15 13:24:30 |
| Message-ID: | 11465.1747315470@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> On Thu, 2025-05-15 at 16:27 +0800, James Pang wrote:
>> why inserts into partition table cause "relation lock" ?
> Something else does; use the pg_blocking_pids() function with the process ID of
> a blocked backend to find out who is holding the lock.
More specifically: the inserts are only trying to get a shared lock.
If they are blocked, it's because some other operation is already
holding an exclusive lock on the table and is not letting go.
Look for uncommitted DDL changes.
More details about that at [1].
regards, tom lane
[1] https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES
| From | Date | Subject | |
|---|---|---|---|
| Next Message | James Pang | 2025-05-15 13:32:38 | Re: a lot of session wait on lock relation |
| Previous Message | Laurenz Albe | 2025-05-15 12:08:05 | Re: a lot of session wait on lock relation |