[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: DBeaver session populating pg_stat_activity.backend_xmin
From:       Thomas Kellerer <shammat () gmx ! net>
Date:       2023-01-25 19:56:45
Message-ID: e2ee1240-016d-14db-ebe7-7aa03d9d1e12 () gmx ! net
[Download RAW message or body]

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 stat=
ements during the "log in".
And the first query will start a transaction, but as autocommit is disable=
d, 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 se=
nt through the JDBC driver, the driver will
send a BEGIN to start the transaction, but the the application (or the use=
r) is responsible to end it through a COMMIT
(or ROLLBACK).



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic