Re: DBeaver session populating pg_stat_activity.backend_xmin - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: DBeaver session populating pg_stat_activity.backend_xmin
Date
Msg-id e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net
Whole thread Raw
In response to DBeaver session populating pg_stat_activity.backend_xmin  ("Dirschel, Steve" <steve.dirschel@thomsonreuters.com>)
Responses RE: [EXT] Re: DBeaver session populating pg_stat_activity.backend_xmin
List pgsql-general
Dirschel, Steve schrieb am 25.01.2023 um 20:36:
> When I connect to the database through DBeaver with those 2 default
> settings changed and find that session in pg_stat_activity column
> xact_start is populated along with backend_xmin.  Those get
> populated just by logging in.

As you found out in the log, the driver runs DbEaver run multiple SQL statements during the "log in".
And the first query will start a transaction, but as autocommit is disabled, nothing will end
that transaction.

> The problem is users will connect using DBeaver and their sessions
> will sit idle.

Idle is not a problem, "idle in transaction" is.

> It executes the exact same commands except when the 2 default
> DBeaver settings are changed to show the issue it is issuing a BEGIN
> and COMMIT around one block of code and then at another part of code
> it issues a BEGIN, runs some queries, and never issues a COMMIT.

Yes, that's how turning off autocommit works. As soon as a statement is sent through the JDBC driver, the driver will
send a BEGIN to start the transaction, but the the application (or the user) is responsible to end it through a COMMIT
(or ROLLBACK).




pgsql-general by date:

Previous
From: "Dirschel, Steve"
Date:
Subject: DBeaver session populating pg_stat_activity.backend_xmin
Next
From: "Dirschel, Steve"
Date:
Subject: RE: [EXT] Re: DBeaver session populating pg_stat_activity.backend_xmin