pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Waiting connections postgres 10
2+ messages / 2 participants
[nested] [flat]

* Waiting connections postgres 10
@ 2018-07-23 16:41 Nicola Contu <Nicola.Contu@gtt.net>
  2018-07-24 05:58 ` Re: Waiting connections postgres 10 Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 2+ messages in thread

From: Nicola Contu @ 2018-07-23 16:41 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>; +Cc: Alessandro Aste <alessandro.aste@gtt.net>

Hello,

we used to monitor waiting connections with postgres 9.6.6 via this query :


select count (*) from pg_stat_activity where wait_event IS NOT NULL


Now  with postgres 10 it seems a bit harder to understand when a query from the application is waiting.


I  built this query but not sure I'm getting the right information.


select count (*) from pg_stat_activity where wait_event_type ='Client' and wait_event IN ('ClientRead','ClienteWrite') and state='idle'


Can anyone help me?


Thanks

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Waiting connections postgres 10
  2018-07-23 16:41 Waiting connections postgres 10 Nicola Contu <Nicola.Contu@gtt.net>
@ 2018-07-24 05:58 ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2018-07-24 05:58 UTC (permalink / raw)
  To: Nicola Contu <Nicola.Contu@gtt.net>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>; Alessandro Aste <alessandro.aste@gtt.net>

On Mon, Jul 23, 2018 at 04:41:59PM +0000, Nicola Contu wrote:
> we used to monitor waiting connections with postgres 9.6.6 via this
> query: 
> 
> select count (*) from pg_stat_activity where wait_event IS NOT NULL

Please note that a wait event becomes NULL once it is reset, so what
this query does is to monitor backends which are not waiting on
something, not backends which are idle.  Hence you would include
backends also doing some active work.

> select count (*) from pg_stat_activity where wait_event_type ='Client'
> and wait_event IN ('ClientRead','ClienteWrite') and state='idle'.
>
> Can anyone help me?

You are visibly looking for a WHERE clause defined with state IN
('idle', 'idle in transaction') when looking for connections waiting for
some activity to be generated by the application, which works also with
9.6.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-07-24 05:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-23 16:41 Waiting connections postgres 10 Nicola Contu <Nicola.Contu@gtt.net>
2018-07-24 05:58 ` Michael Paquier <michael@paquier.xyz>

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