Re: Finding if old transactions are running...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jtv(at)xs4all(dot)nl
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(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:31:00
Message-ID: 1989.1109313060@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

jtv(at)xs4all(dot)nl writes:
> 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?

pg_locks certainly seems like a better solution. Perhaps it didn't
exist when you went with pg_stat_activity? Can't recall offhand.

Note that you still want to look for your old backend's PID; it seems
impractically expensive to keep track of the current transaction's XID.
(At a minimum that would cost another query per xact...)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2005-02-25 06:47:39 Re: 8.0.X and the ARC patent
Previous Message jtv 2005-02-25 06:22:23 Re: Finding if old transactions are running...