Re: SELECT .. FOR UPDATE: find out who locked a row - Mailing list pgsql-general

From Stephen Frost
Subject Re: SELECT .. FOR UPDATE: find out who locked a row
Date
Msg-id 20180315220512.GV2416@tamriel.snowman.net
Whole thread Raw
In response to Re: SELECT .. FOR UPDATE: find out who locked a row  ("Enrico Thierbach" <eno@open-lab.org>)
Responses Re: SELECT .. FOR UPDATE: find out who locked a row  (Melvin Davidson <melvin6925@gmail.com>)
List pgsql-general
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

Attachment

pgsql-general by date:

Previous
From: "Enrico Thierbach"
Date:
Subject: Re: SELECT .. FOR UPDATE: find out who locked a row
Next
From: Foolish Ewe
Date:
Subject: Want to disable fully qualified table names on pg_dump in pg_dump(PostgreSQL) 9.6.8