Re: [EXT] DBeaver session populating pg_stat_activity.backend_xmin

Christophe Pettus <xof@thebuild.com>

From: Christophe Pettus <xof@thebuild.com>
To: "Dirschel, Steve" <steve.dirschel@thomsonreuters.com>
Cc: Thomas Kellerer <shammat@gmx.net>, "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2023-01-25T22:49:17Z
Lists: pgsql-general

> On Jan 25, 2023, at 14:21, Dirschel, Steve <steve.dirschel@thomsonreuters.com> wrote:
> From my perspective "idle in transaction" isn't necessarily a problem (although I don't like seeing sessions sitting like that for a long time).  The problem is when pg_stat_activity.backend_xmin is populated-  that can prevent autovacuum from cleaning up old records.

I don't think that analysis is quite correct.  There's nothing about backend_xmin that blocks tuple cleanup *if the transaction has been committed*.  The problem is that the session is sitting in idle in transaction state, and *that* blocks tuple cleanup.  The fix is to not leave sessions open in idle in transaction state.