pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: schen@graciousstyle.com
Cc: pgsql-general@postgresql.org
Cc: pgsql-novice@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: how to find transaction associated with a lock
Date: Thu, 22 Jul 2004 16:45:03 -0400
Message-ID: <12341.1090529103@sss.pgh.pa.us> (raw)
In-Reply-To: <41001296.3090609@graciousstyle.com>
References: <41001296.3090609@graciousstyle.com>

Si Chen <schen@graciousstyle.com> writes:
> Does anyone know of a way to go from transactions identifiers to the 
> actual transaction--which tables, which statements, etc. etc.?

See pg_stat_activity.

The pg_locks entries you are looking at do *not* represent table locks
of any kind.  This:
> NULL NULL 3366868 27149 ExclusiveLock TRUE
simply says that transaction 3366868 is still running.  This:
> NULL NULL 3366868 1069 ShareLock FALSE
says that process 1069 has elected to wait until transaction 3366868
finishes.  Normally the reason for doing that would be that transaction
3366868 holds a row lock (SELECT FOR UPDATE lock) on some row that
process 1069's transaction wants to acquire row lock on.

However, I suspect what you are really wishing is to find out the
individual row that is being contended for, and there is not enough
information in the system views to do that (mainly because we do not
keep per-row locking information in shared memory).

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <12341.1090529103@sss.pgh.pa.us>
Permalink:  ../12341.1090529103@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12341.1090529103@sss.pgh.pa.us

 · 

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, schen@graciousstyle.com, pgsql-general@postgresql.org, pgsql-novice@postgresql.org
  Subject: Re: how to find transaction associated with a lock
  In-Reply-To: <12341.1090529103@sss.pgh.pa.us>
  References: <41001296.3090609@graciousstyle.com> <12341.1090529103@sss.pgh.pa.us>

* 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