Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBVjp-0002M2-Qz for pgsql-admin@arkaria.postgresql.org; Mon, 15 Feb 2021 04:43:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lBVjo-00074Y-OK for pgsql-admin@arkaria.postgresql.org; Mon, 15 Feb 2021 04:43:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBVjo-00074Q-5o for pgsql-admin@lists.postgresql.org; Mon, 15 Feb 2021 04:43:56 +0000 Received: from admin.sibptus.ru ([2001:19f0:5001:21dc::10]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBVjk-0001qZ-M4 for pgsql-admin@lists.postgresql.org; Mon, 15 Feb 2021 04:43:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=jtJcY2m0I8ar+DXDyrTQfX8K1OyVHlxchXzqM+tQL8w=; b=MdkDaOyPHkAxBK3lyPvvttinUk 5WA0kiIVehbt2loojcNJRMxc2ZAcJIwu+XdeKeNQXooANwjPp+PyjsuaZboplYcuWNRVA8D240MZF b0tQLUlKvyA9LG16D0YCPZo7syRIotQfAN5hw5etGKFUb9J4dVTtcR7r1rtTfHghsyXs=; Received: from vas by admin.sibptus.ru with local (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lBVji-000MYW-OA; Mon, 15 Feb 2021 11:43:50 +0700 Date: Mon, 15 Feb 2021 11:43:50 +0700 From: Victor Sudakov To: Keith Fiske Cc: Pgsql-admin Subject: Re: index bloat estimation Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Keith Fiske wrote: > > > > What queries do you use to estimate index and table bloat? [dd] > Why estimate when you can get the exact amount? At least for b-tree indexes > anyway. > > https://github.com/keithf4/pg_bloat_check Hello Keith, Thanks for this script and for reminding about pgstattuple. The script has the drawback of requiring r/w access to the database, so it cannot be run on a replica. But the idea is excellent. At least it can show the top N bloated relations, and then I can further explore with pgstattuple(), pgstatindex() etc. -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/