Re: long running transactions - Mailing list pgsql-performance

From Tom Lane
Subject Re: long running transactions
Date
Msg-id 25404.1160497420@sss.pgh.pa.us
Whole thread Raw
In response to long running transactions  (Tobias Brox <tobias@nordicbet.com>)
Responses Re: long running transactions  (Tobias Brox <tobias@nordicbet.com>)
List pgsql-performance
Tobias Brox <tobias@nordicbet.com> writes:
> If pg_stat_activity.query_start actually is the start time of the
> transaction,

... but it isn't.

> Is there any way to find the longest running transaction?

Look in pg_locks to see the lowest-numbered transaction ID --- each
transaction will be holding exclusive lock on its own XID.  You can
correlate that back to pg_stat_activity via the PID.

            regards, tom lane

pgsql-performance by date:

Previous
From: Tobias Brox
Date:
Subject: long running transactions
Next
From: Bruno Wolff III
Date:
Subject: Re: Simple join optimized badly?