On Thu, Feb 24, 2005 at 11:14:07AM -0500, Tom Lane wrote:
> Christopher Kings-Lynne <chriskl@familyhealth.com.au> 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 that you could assortedly:
>
> > 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.
You can get list of currently runing transactions from pg_locks table,
but no start time...
But if you can remember oldest transaction_id from the last vacuum then
you got what you need: if oldest transaction still here - you not
need to vacuum