Re: Timing out A Blocker Based on Time or Count of Waiters

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Fred Habash <fmhabash(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Timing out A Blocker Based on Time or Count of Waiters
Date: 2024-03-22 16:31:58
Message-ID: 4d234943-b4bf-4e59-aa89-e5d69e18a228@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/22/24 09:25, Fred Habash wrote:
> Facing an issue where sometimes humans login to a database and run DDL
> statements causing a long locking tree of over 1000 waiters. As a

The above needs more explanation:

1) Define locking tree.

2) Define waiters.

3) Provide examples of the DDL.

> workaround, we asked developers to always start their DDL sessions
> with 'SET lock_timeout = 'Xs'.
>
> I reviewed the native lock timeout parameter in Postgres and found 7.
> None seem to be related to blocker timeouts directly.
>
> idle_in_transaction_session_timeout
> idle_session_timeout
> lock_timeout: How long a session waits for a lock
> statement_timeout
> authentication_timeout
> deadlock_timeout
> log_lock_waits
>
> Instead, I put together a quick procedure that counts waiter sessions
> for a given blocker and terminates it if waiter count exceeds a threshold.
>
> Is there not a native way to ...
> 1. Automatically time out a blocker
> 2. A metric that shows how many waiters for a blocker?
>
> Thanks
> --
>
> ----------------------------------------
> Thank you
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nathan Bossart 2024-03-22 16:39:52 Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs
Previous Message Fred Habash 2024-03-22 16:25:16 Timing out A Blocker Based on Time or Count of Waiters