Re: vacuum vs open transactions - Mailing list pgsql-general

From Ed L.
Subject Re: vacuum vs open transactions
Date
Msg-id 200501131204.29019.pgsql@bluepolka.net
Whole thread Raw
In response to vacuum vs open transactions  ("Ed L." <pgsql@bluepolka.net>)
List pgsql-general
On Thursday January 13 2005 11:37, Michael Fuhr wrote:
>
> That'll show which transaction is oldest but not how long it's been
> open or idle, i.e., whether it's "long-open" or not.  I assumed,
> perhaps incorrectly, that he was already looking at pg_locks and
> wanted to find out which of those transactions had been open for a
> long time.  Since pg_locks has a pid column, you can join (visually
> or via a join query) with pg_stat_activity's procpid column.

What I'm after is a simple way to automatically tell via cron query if there
is a transaction staying open long enough (probably an hour) to cause bloat
but that doesn't require any visual inspection.  While not fool-proof,
pg_stat_activity.query_start looks like a 90% answer.

It'd be nice if pg_stat_activity.transaction_start were added in the future
for a 100% answer, but I'm not sure there's much interest in this apart
from our needs.

Ed


pgsql-general by date:

Previous
From: "Frank D. Engel, Jr."
Date:
Subject: Re: allowing connections from additional hosts without a restart?
Next
From: "Craig Bryden"
Date:
Subject: Functions returning RECORD