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 1ffLEV-0006qA-BY for pgsql-general@arkaria.postgresql.org; Tue, 17 Jul 2018 08:21:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ffLET-0002ae-NC for pgsql-general@arkaria.postgresql.org; Tue, 17 Jul 2018 08:21:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffLET-0002aW-FR for pgsql-general@lists.postgresql.org; Tue, 17 Jul 2018 08:21:17 +0000 Received: from smtp5-g21.free.fr ([2a01:e0c:1:1599::14]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffLER-0000uT-8r for pgsql-general@lists.postgresql.org; Tue, 17 Jul 2018 08:21:17 +0000 Received: from firost (unknown [109.9.177.254]) (Authenticated sender: ioguix) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 8663A5FFAB; Tue, 17 Jul 2018 10:21:09 +0200 (CEST) Date: Tue, 17 Jul 2018 10:21:08 +0200 From: "Jehan-Guillaume (ioguix) de Rorthais" To: Fabio Pardi Cc: pgsql-general@lists.postgresql.org Subject: Re: Query to monitor index bloat Message-ID: <20180717102108.0de002a8@firost> In-Reply-To: References: X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 17 Jul 2018 10:11:50 +0200 Fabio Pardi wrote: > If you monitor using nagios (or if you want to make a wrapper around it): >=20 > https://bucardo.org/check_postgres/check_postgres.pl.html#bloat ...and check this one: https://github.com/OPMDG/check_pgactivity/ It uses bloat queries for tables and btree indexes Adrien Nayrat was pointi= ng earlier in this thread. In fact, both queries in check_pgactivity were written because the bloat ch= eck in check_postgres was considering **all** fields were in **all*** indexes...Which is quite a large approximation...I don't know if this is st= ill the case though. > works like a charm. >=20 > regards, >=20 > fabio pardi >=20 >=20 > On 07/16/2018 05:16 PM, Alessandro Aste wrote: > > Hello,=C2=A0 I am trying to put togheter a query to monitor the index b= loat > > for a database I maintain. > > Is there a "SQL" way to obtain=C2=A0 bloated index ? I googled around b= ut I > > found nothing working. > >=20 > > I'm currently running 9.6 but I'm looking for something compatible with > > version 10 too. > >=20 > > Thank you very much in advance,