pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Enrico Thierbach <eno@open-lab.org>
Cc: Melvin Davidson <melvin6925@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: SELECT .. FOR UPDATE: find out who locked a row
Date: Thu, 15 Mar 2018 18:05:12 -0400
Message-ID: <20180315220512.GV2416@tamriel.snowman.net> (raw)
In-Reply-To: <206B6740-DCC5-4491-A87D-EEF5CBF8EA6B@open-lab.org>
References: <E269BF34-4CE1-47EC-8A80-F18DE55E2BEF@open-lab.org>
	<20180315204851.GU2416@tamriel.snowman.net>
	<CANu8FixnK=FJswaK8o=eWZ7smOTh=qpb8ciFAYd9oWUCS4tb1A@mail.gmail.com>
	<206B6740-DCC5-4491-A87D-EEF5CBF8EA6B@open-lab.org>

Greetnigs,

* Enrico Thierbach (eno@open-lab.org) wrote:
> I guess with your query I can figure out which connection holds a lock, but
> it seems I cannot correlate those locks to the rows which actually are
> locked, since `pg_locks` seems not to reference this in any way.

What I gave you would work, or you could use the pgrowlocks extension:

https://www.postgresql.org/docs/current/static/pgrowlocks.html

Using pgrowlocks will be slow if you have a lot of records in the table
though, hence the other approach I mentioned since it sounds like you
know the ID that you're interested in.

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (19+ messages)  latest in thread

Message-ID: <20180315220512.GV2416@tamriel.snowman.net>
Permalink:  ../20180315220512.GV2416@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20180315220512.GV2416@tamriel.snowman.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: sfrost@snowman.net, eno@open-lab.org, melvin6925@gmail.com
  Subject: Re: SELECT .. FOR UPDATE: find out who locked a row
  In-Reply-To: <20180315220512.GV2416@tamriel.snowman.net>
  References: <E269BF34-4CE1-47EC-8A80-F18DE55E2BEF@open-lab.org> <20180315204851.GU2416@tamriel.snowman.net> <CANu8FixnK=FJswaK8o=eWZ7smOTh=qpb8ciFAYd9oWUCS4tb1A@mail.gmail.com> <206B6740-DCC5-4491-A87D-EEF5CBF8EA6B@open-lab.org> <20180315220512.GV2416@tamriel.snowman.net>

* 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