Skip site navigation (1) Skip section navigation (2)

Re: Finding if old transactions are running...

From: jtv(at)xs4all(dot)nl
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>,"Christopher Browne" <cbbrowne(at)acm(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Finding if old transactions are running...
Date: 2005-02-25 06:22:23
Message-ID: 25376. (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Bruce Momjian wrote:

>> > You can get that from pg_stat_activity, if you have the relevant stats
>> > turned on.
>> pg_stat_activity will tell you about the oldest active query, but not
>> about oldest open transaction.
> And pg_stat_activity can lose information when the network is under
> heavy load too.

On a side note, a similar issue came up with libpqxx, in the part that
deals with connections being lost while committing a transaction.  The
library tries to reconnect and figure out whether the commit completed or
not, but it was pointed out that the commit might actually still be in
progress by that time.

Tom, I believe you said at the time that I should check pg_stat_activity. 
My current code polls it for the old backend pid.  But if that is neither
100% reliable nor unconditionally available, wouldn't it be better if I
just queried pg_locks for the transaction's ID?  Would that work for all
backend versions I can expect to see?


In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2005-02-25 06:31:00
Subject: Re: Finding if old transactions are running...
Previous:From: Bruce MomjianDate: 2005-02-25 05:18:37
Subject: Re: 8.0.X and the ARC patent

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group