From: | Sergey Konoplev <gray(dot)ru(at)gmail(dot)com> |
---|---|
To: | Moshe Jacobson <moshe(at)neadwerx(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org>, Chris Autry <chris(at)neadwerx(dot)com> |
Subject: | Re: Strange locking problem |
Date: | 2013-05-21 23:26:38 |
Message-ID: | CAL_0b1u+iy-hF87e6j6EkX0aFzbg6LG_MjM6rZjWOd16ftiajw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, May 21, 2013 at 12:24 PM, Moshe Jacobson <moshe(at)neadwerx(dot)com> wrote:
> I wanted to see what was happening in that transaction ID that might be
> causing this lock to be held, but I was unsure how. I know I can look in
> pg_locks for the other transaction, but that will not tell me what statement
> is executing in that transaction. pg_stat_activity does not have a
> transaction ID column.
>
> How can I see what statement is executing in a transaction?
You can join pg_locks and pg_stat_activity by pid (or procpid = pid if
your version <9.2).
SELECT
...
current_query
...
FROM pg_locks AS l
LEFT JOIN pg_stat_activity AS a ON
-- procpid = pid -- <9.2
a.pid = l.pid -- >=9.2
...
--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA
Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray(dot)ru(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Sajeev Mayandi | 2013-05-21 23:27:30 | DECLARING THE CURSOR WITH HOLD |
Previous Message | Dev Kumkar | 2013-05-21 22:49:14 | Re: [ODBC] ODBC constructs |