Re: PostgreSQL server "idle in transaction"

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL server "idle in transaction"
Date: 2022-11-16 12:25:41
Message-ID: 20221116122541.GD9@sh4-5.1blu.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El día Dienstag, November 15, 2022 a las 10:28:11 -0500, Tom Lane escribió:

> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> > On 11/15/22 04:28, Matthias Apitz wrote:
> >> I have below the full ESQL/C log and do not understand, why the
> >> PostgreSQL server is thinking "idle in transaction". For me with the
> >> "COMMIT" on the line below marked with ^^^^^ the transaction was closed.
>
> > From your log:
>
> > [6978] [15.11.2022 11:05:50:172]: ECPGtrans on line 1211: action
> > "commit"; connection "testdb"
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > [6978] [15.11.2022 11:05:50:173]: ecpg_execute on line 543: query:
> > select name from pg_cursors where name = $1 ; with 1 parameter(s) on
> > connection testdb
>
> > So that query is being executed after the COMMIT.
>
> Right. By default, ecpg would start a new transaction block for that.
> See
>
> https://www.postgresql.org/docs/current/ecpg-commands.html#ECPG-TRANSACTIONS
>

Additional question: We're using COMMIT to commit data changes or
deletions into the database. What is the technical impact of such
backends sitting with "idle in transaction" because the application
after doing some work and now waiting for new work, have done before
going to wait such queries for open cursors without any result?

Thanks

matthias
--
Matthias Apitz, ✉ guru(at)unixarea(dot)de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Gustafsson 2022-11-16 12:56:43 Re: unrecognized node type: 350
Previous Message Fabrice Chapuis 2022-11-16 12:08:13 Re: pg_restore remap schema