pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Discard All in pgbouncer
Date: Mon, 9 Oct 2023 10:39:11 -0500
Message-ID: <897f06dd-b6a4-eeef-1b88-e643a4bb5c6b@gmail.com> (raw)
In-Reply-To: <CAJk5AtbOeXVLDj5frFBy3Bw9xxja-bY1hcObMWonQ-xW-Oq=HQ@mail.gmail.com>
References: <CAJk5AtachHvTqeMT=Y+3wKaRgQnO8ypBUPvGQK4JFH5thkxcew@mail.gmail.com>
	<CAAo1mbkLHPZYr7AGthoSg3pFf14LLNbEbZdCJUUoVxm6Bd1jjg@mail.gmail.com>
	<CAJk5AtbOeXVLDj5frFBy3Bw9xxja-bY1hcObMWonQ-xW-Oq=HQ@mail.gmail.com>

You're */still/* missing the point.  If pgbouncer doesn't need to use a 
connection, then... it's going to sit there "idle". That's what "idle" means!

What we haven't explicitly stated, but implied, is that pg_stat_activity 
*does not* clear the query field when the status = 'idle'.  Thus, as we've 
said before, DISCARD ALL /*was*//**/ the last statement to be executed.

On 10/9/23 09:18, Rajesh Kumar wrote:
> Purpose of bouncer is handle idle connections right? Is there a time 
> period for the DISCARD ALL to go away? If so, how to configure?
>
> The part I don't understand is if bunch of connections in the name of 
> Discard all is idle ,  what difference it make?
>
> On Mon, 9 Oct 2023, 19:42 Samed YILDIRIM, <samed@reddoc.net> wrote:
>
>     Hi Rajesh,
>
>     DISCARD ALL is the query that is executed by PgBouncer in order to
>     sanitise a database session before assigning it to another client. If
>     you see this query in pg_stat_activity and status of the session is
>     idle, most probably it is ok. Probably what you see is the last
>     executed query for the session. And the session is idle and waiting to
>     be assigned to a client. :)
>
>     Best regards.
>     Samed YILDIRIM
>
>     On Mon, 9 Oct 2023, 17:07 Rajesh Kumar, <rajeshkumar.dba09@gmail.com>
>     wrote:
>
>         Hi,
>
>         I could see queries like DISCARD ALL is idle for more than
>         5minutes (we are using pgbouncer).
>
>         Why is it idle for more than 5mns? I read about pgbouncer and
>         could not understand this thing. If resetting a connection using
>         query becomes one idle connection, I don't understand the pooling
>         system here
>
>         Plz help
>

-- 
Born in Arizona, moved to Babylonia.

view thread (12+ messages)

Message-ID: <897f06dd-b6a4-eeef-1b88-e643a4bb5c6b@gmail.com>
Permalink:  ../897f06dd-b6a4-eeef-1b88-e643a4bb5c6b@gmail.com/
Also on:    postgresql.org/message-id/897f06dd-b6a4-eeef-1b88-e643a4bb5c6b@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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Discard All in pgbouncer
  In-Reply-To: <897f06dd-b6a4-eeef-1b88-e643a4bb5c6b@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