pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Si Chen <sichen@opensourcestrategies.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Ned to understand why all the idle connections
Date: Thu, 23 Apr 2020 15:36:55 -0700
Message-ID: <CAAYSSjO8QzO2YYW07_Ue6n+G2FiqAWivU8nCtpcZEqZGoRJ+Fw@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwZ9N2KHDi0rgA2ag436hiXtDuTOjrSLS_CzJ5n_QCOD+w@mail.gmail.com>
References: <CAMBRECByuKOkFAyZXwCRR59q1YpMbcA4_4PfsvCznfZ47A951A@mail.gmail.com>
	<CAKFQuwYBBg76KYtfFNNFWqW4+VdOhngE45cN+uDuTJR5h8UTNw@mail.gmail.com>
	<CAAYSSjPGHt65GuF1UO7=53vqV5fgdW=pBysregqnR6wqLWNZAQ@mail.gmail.com>
	<CAKFQuwZ9N2KHDi0rgA2ag436hiXtDuTOjrSLS_CzJ5n_QCOD+w@mail.gmail.com>

Thanks for answering my questions.

Sorry I didn't mean to "top post"  I thought that my other email got lost
because I had sent it to lists.postgresql.org

-----
Si Chen
Open Source Strategies, Inc.

Our Mission: https://www.youtube.com/watch?v=Uc7lmvnuJHY



On Thu, Apr 23, 2020 at 2:31 PM David G. Johnston <
david.g.johnston@gmail.com> wrote:

> Please don't top-post; and this is a fairly rude hijack posting given that
> you already have a thread going, from today no less, where you've basically
> asked this very same question.
>
> On Thu, Apr 23, 2020 at 2:18 PM Si Chen <sichen@opensourcestrategies.com>
> wrote:
>
>> Hello David & David,
>>
>> I have a similar problem -- a lot of idle transactions.  I'm using the
>> PostgreSQL JDBC driver.  The connections look like this:
>>
>>  pid  | wait_event |         state_change          |
>>   backend_start         | xact_start |          query_start          |
>>   ?column?     | query
>>
>>
>> -------+------------+-------------------------------+-------------------------------+------------+-------------------------------+-----------------+--------
>>
>>  32506 | ClientRead | 2020-04-23 09:29:05.6793-07   | 2020-04-23
>> 01:00:19.612478-07 |            | 2020-04-23 09:29:05.679275-07 |
>> 00:00:00.000025 | COMMIT
>>
>>  32506 | ClientRead | 2020-04-23 09:30:33.247119-07 | 2020-04-23
>> 01:00:19.612478-07 |                               | 2020-04-23
>> 09:30:33.247109-07 | 00:00:00.00001  | COMMIT
>>
>>  32506 | ClientRead | 2020-04-23 09:31:31.506914-07 | 2020-04-23
>> 01:00:19.612478-07 |                               | 2020-04-23
>> 09:31:31.506905-07 | 00:00:00.000009 | COMMIT
>>
>>  32506 | ClientRead | 2020-04-23 09:32:32.06656-07  | 2020-04-23
>> 01:00:19.612478-07 |            | 2020-04-23 09:32:32.066552-07 |
>> 00:00:00.000008 | COMMIT
>>
>>  32506 | ClientRead | 2020-04-23 09:36:51.579939-07 | 2020-04-23
>> 01:00:19.612478-07 |            | 2020-04-23 09:36:51.579931-07 |
>> 00:00:00.000008 | COMMIT
>>
>> It seems like they haven't been doing anything for a long time, but the
>> state_change keeps getting updated.
>>
>
> If the state_change timestamp keeps changing then by definition they are
> doing something......
>
>
>>   Is it possible that state_change is being updated, maybe by the JDBC
>> driver?
>>
>
> Directly, no, that particular field is read-only by the user and so
> nothing is going to directly update it.  However, as soon as the session
> changes state it will change as well.
>
> The most likely answer is that your setup for JDBC includes a connection
> pool that is periodically checking to see if its session is still active.
> You should work on trying to prove or disprove that assumption.
>
> Do you recommend using PgBouncer with JDBC?
>>
>
> I try to avoid making recommendations without knowing the situation in
> which something is operating.  Given the level of expertise demonstrated
> here I would, however, advise against adding another architectural
> component to your setup until your understand completely what you are
> already working with.  If at that point you can define a problem that you
> want to solve, and pgBouncer would constitute a solution, then you could
> consider adding it.
>
> David J.
>
>

view thread (7+ messages)

Message-ID: <CAAYSSjO8QzO2YYW07_Ue6n+G2FiqAWivU8nCtpcZEqZGoRJ+Fw@mail.gmail.com>
Permalink:  ../CAAYSSjO8QzO2YYW07_Ue6n+G2FiqAWivU8nCtpcZEqZGoRJ+Fw@mail.gmail.com/
Also on:    postgresql.org/message-id/CAAYSSjO8QzO2YYW07_Ue6n+G2FiqAWivU8nCtpcZEqZGoRJ+Fw@mail.gmail.com

 · 

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: sichen@opensourcestrategies.com, david.g.johnston@gmail.com
  Subject: Re: Ned to understand why all the idle connections
  In-Reply-To: <CAAYSSjO8QzO2YYW07_Ue6n+G2FiqAWivU8nCtpcZEqZGoRJ+Fw@mail.gmail.com>
  References: <CAMBRECByuKOkFAyZXwCRR59q1YpMbcA4_4PfsvCznfZ47A951A@mail.gmail.com> <CAKFQuwYBBg76KYtfFNNFWqW4+VdOhngE45cN+uDuTJR5h8UTNw@mail.gmail.com> <CAAYSSjPGHt65GuF1UO7=53vqV5fgdW=pBysregqnR6wqLWNZAQ@mail.gmail.com> <CAKFQuwZ9N2KHDi0rgA2ag436hiXtDuTOjrSLS_CzJ5n_QCOD+w@mail.gmail.com> <CAAYSSjO8QzO2YYW07_Ue6n+G2FiqAWivU8nCtpcZEqZGoRJ+Fw@mail.gmail.com>

* 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