Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fhqL4-0004t5-Eu for pgsql-general@arkaria.postgresql.org; Tue, 24 Jul 2018 05:58:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fhqL2-0004dH-3j for pgsql-general@arkaria.postgresql.org; Tue, 24 Jul 2018 05:58:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fhqL1-0004dA-Jc for pgsql-general@lists.postgresql.org; Tue, 24 Jul 2018 05:58:23 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fhqKt-0002Xz-Gq for pgsql-general@lists.postgresql.org; Tue, 24 Jul 2018 05:58:21 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 308AF574; Tue, 24 Jul 2018 01:58:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 24 Jul 2018 01:58:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=c0YRxFIJW33OmIsCIU3xqy03ai6rBGi58+YgXWY87gE=; b=dclKK6Kx KOjVdvzgj182a4a1lJiyvs6PG6L3p/rxyCnZV77jwmtfyOq/Zeo9CXECoky7HoUI GqsiwzdcPyoPukjvRgH37BcrMEhCguOdkstKuYxxMr9ZgioJ5Gq/RolVUVAzrca+ 0kJm6iU5N8bcpCcAON8kJvD6PWzDztVlH+AcauIKXxcDpm1z6l+0xriBt8Yo9+e5 zXpJ7dz0x+J4LSVywF8q7LO67EqFa8Lij56kgIAJuBWbljSgHccLRtPyiYoSQjjz ysN05lu3UVv+ZxarUOrK20g1zHReYocaBDmpK4GJ7spweIex4JipHtS0/o0hLzGz v/WjKcT8R5TPoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=c0YRxFIJW33OmIsCIU3xqy03ai6rB Gi58+YgXWY87gE=; b=we948YsdK7M0oMjaAUOFFUgeI58cTdsaUWrFeAulCpw/a 0F4BkahYsK5kFd3hN4ObviURrKCbPdaNZ5vlak7c+/1FJUrJV5PP560Gy9CQtzki y7Y+MwbIKb67Mb+MwVu14r+hWyBk6AJGQxzLrX/UdCSOo8aMwNDp4PcwlR1EvC/C iY6Dyo0Rh7Hq76+asOzr4JTEZpAWFO0QJGMGSkOMk8D7r7rUyKw9pJoutUPlcOws JI5VKyZLqFe1tmvxbgu8D28VSK/MYz1BGru05OSwvEK4q517EEcj9nVZJg2rx/aN m94cBdbkMtBBbx81Qu0WzGA1s+XbpSf8kWopNIJHw== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 2D1C310268; Tue, 24 Jul 2018 01:58:11 -0400 (EDT) Date: Tue, 24 Jul 2018 14:58:09 +0900 From: Michael Paquier To: Nicola Contu Cc: "pgsql-general@lists.postgresql.org" , Alessandro Aste Subject: Re: Waiting connections postgres 10 Message-ID: <20180724055809.GE4736@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BZaMRJmqxGScZ8Mx" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --BZaMRJmqxGScZ8Mx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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:=20 >=20 > 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 =3D'Client' > and wait_event IN ('ClientRead','ClienteWrite') and state=3D'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 --BZaMRJmqxGScZ8Mx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAltWv/EACgkQnvQgOdby QH3mgRAAhdfSSZW5dUckgGKzD4aFFGAYUkloBUqcVCvZmOwGAGYnwWQYHpiKLmCF ThB/7K9sbErrx8nDBhRBO8w/Xe2xR+9Dtx7lSD3pz8v5X8uMMcY7NZGMXkqbqCFj pBY82yjccdwqCENwRUecxHbdfTSk/UXdfiktGWxrTME9AMgfyqQFh6Ta/bGznHrx Ygj/3gbV7+Y2OWyt63D6H8lRIqFFzDNQ2rMSS9M5v+jfJf9f03+zbSVmdHLyo9GX nU9uxEp36O7FwbPIHY/9OaxT6HQ5taXLLMsMfL2q6IqRUjzkijzHkl0tn4cFO90A P4WQran73x9wQvIAgt+eVErv1jAF95jjchDSCpyI5Un/sgFD96iTLaKKVNSuczKH oCBv12ZbB7MoMnEOIq+Q9n+WD6XFLRwu2G+++3cqi2B+0rstvQudtAZdRrnQJomH /7MuqDRzv/erYZaE78GqLxb41t8296aM1rsZ5xUcikaPWVqlRTxh4J3eohX5gTZ6 6ZjIK0ABy8MjzSTMLN8G/CBdElxdA1h5v0jAOMurix692mh+M+JbvnYVdqJaRlKw JC3S5czSbBKmWEYrlNuRremCfMlC0Br0pE0V3lIaUuBM50BI3Cs55UUB+iHE0qCP rrL3mhK7M6EEYVOeg4IBNyOHTKVsRc4bxP6gEHYLkItdZN2JYA4= =xRFR -----END PGP SIGNATURE----- --BZaMRJmqxGScZ8Mx--