Re: [HACKERS] Finding if old transactions are running...

2005-02-28 Thread Christopher Browne
I can see this function available in the backend: TransactionId GetOldestXmin(bool alldbs); The cost is based on walking thru each backend process, which I guess is obvious, as if there are 47 backends, that means 47 xids. Presumably not _too_ expensive; certainly something that has to be run

Re: [HACKERS] Finding if old transactions are running...

2005-02-28 Thread Christopher Browne
In an attempt to throw the authorities off his trail, Christopher Browne <[EMAIL PROTECTED]> transmitted: > It sure would be nice to be able to have a way to query the start > time of the eldest transaction on the system. I can see this function available in the backend: TransactionId GetOlde

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread jtv
> [EMAIL PROTECTED] writes: > pg_locks certainly seems like a better solution. Perhaps it didn't > exist when you went with pg_stat_activity? Can't recall offhand. Neither do I... But I do need something that will work with at least any recent backend version--say, 7.2 or since. The more the

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread Tom Lane
[EMAIL PROTECTED] 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

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread jtv
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 > h

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread Bruce Momjian
Tom Lane wrote: > Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > >> It sure would be nice to be able to have a way to query the start time > >> of the eldest transaction on the system. If that could be done at a > >> not-too-high cost, it would be eminently helpful for various sorts of > >>

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread Vsevolod Lobko
On Thu, Feb 24, 2005 at 11:14:07AM -0500, Tom Lane wrote: > Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > >> It sure would be nice to be able to have a way to query the start time > >> of the eldest transaction on the system. If that could be done at a > >> not-too-high cost, it would be e

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread Tom Lane
Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: >> It sure would be nice to be able to have a way to query the start time >> of the eldest transaction on the system. If that could be done at a >> not-too-high cost, it would be eminently helpful for various sorts of >> maintenance processes so

Re: [HACKERS] Finding if old transactions are running...

2005-02-24 Thread Christopher Kings-Lynne
It sure would be nice to be able to have a way to query the start time of the eldest transaction on the system. If that could be done at a not-too-high cost, it would be eminently helpful for various sorts of maintenance processes so that you could assortedly: You can get that from pg_stat_activit