Re: Locks analyze

From: Rajesh Kumar <rajeshkumar(dot)dba09(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Locks analyze
Date: 2023-10-13 09:39:18
Message-ID: CAJk5AtZBhKzgu9KOMDxyC7FxTsULS2hWRJ=Zod+2kzmL+KEhnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

How do I identify a session that is blocked?

Can blocking sessions increase idle sessions?

I see something like waitdurarion in pg_locks..is that helpful anyway?

I am often facing idle connection spike. That is why I am checking all
these.

On Fri, 13 Oct, 2023, 11:32 AM Laurenz Albe, <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Fri, 2023-10-13 at 05:16 +0530, Rajesh Kumar wrote:
> > How do I analyze locks and resolve it. Is there only one query that
> helps?
> > This lock issue leading to high connections it seems.
>
> Once you have identified a session that is blocked, get its process ID
> from pg_stat_activity and SELECT pg_blocking_pids(12345);
> with that process number as argument.
>
> Then you get all the other sessions that block that session.
>
> Yours,
> Laurenz Albe
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2023-10-13 11:59:35 Re: Locks analyze
Previous Message Rajesh Kumar 2023-10-13 08:51:25 Re: Automation