pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: DBeaver session populating pg_stat_activity.backend_xmin
Date: Wed, 25 Jan 2023 20:56:45 +0100
Message-ID: <e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net> (raw)
In-Reply-To: <DM6PR03MB43321CA446447D0D6089E5F7FACE9@DM6PR03MB4332.namprd03.prod.outlook.com>
References: <DM6PR03MB43321CA446447D0D6089E5F7FACE9@DM6PR03MB4332.namprd03.prod.outlook.com>

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).






view thread (6+ messages)  latest in thread

Message-ID: <e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net>
Permalink:  ../e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net/
Also on:    postgresql.org/message-id/e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: shammat@gmx.net
  Subject: Re: DBeaver session populating pg_stat_activity.backend_xmin
  In-Reply-To: <e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net>
  References: <DM6PR03MB43321CA446447D0D6089E5F7FACE9@DM6PR03MB4332.namprd03.prod.outlook.com> <e2ee1240-016d-14db-ebe7-7aa03d9d1e12@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox