pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Locks analyze
Date: Fri, 13 Oct 2023 08:02:57 +0200
Message-ID: <91d371667a3e27cb0da7001d048d1c417074b6ef.camel@cybertec.at> (raw)
In-Reply-To: <CAJk5AtaHsNNp-R3zmeeZ9G06LH_yHXEdCN7TpeR2HTO4Tde7Hw@mail.gmail.com>
References: <CAJk5AtaHsNNp-R3zmeeZ9G06LH_yHXEdCN7TpeR2HTO4Tde7Hw@mail.gmail.com>

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





view thread (7+ messages)  latest in thread

Message-ID: <91d371667a3e27cb0da7001d048d1c417074b6ef.camel@cybertec.at>
Permalink:  ../91d371667a3e27cb0da7001d048d1c417074b6ef.camel@cybertec.at/
Also on:    postgresql.org/message-id/91d371667a3e27cb0da7001d048d1c417074b6ef.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, rajeshkumar.dba09@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Locks analyze
  In-Reply-To: <91d371667a3e27cb0da7001d048d1c417074b6ef.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox