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 1lCCYv-0003MI-G9 for pgsql-admin@arkaria.postgresql.org; Wed, 17 Feb 2021 02:27:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lCCYu-0005Jk-FJ for pgsql-admin@arkaria.postgresql.org; Wed, 17 Feb 2021 02:27:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCCYt-00058k-Sv for pgsql-admin@lists.postgresql.org; Wed, 17 Feb 2021 02:27:32 +0000 Received: from admin.sibptus.ru ([2001:19f0:5001:21dc::10]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCCYq-0006T7-Oq for pgsql-admin@lists.postgresql.org; Wed, 17 Feb 2021 02:27:30 +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=qzVC1+OhDP8vYNMLkx/3oxhGETVGmvEDOGdANkcK10g=; b=JqrGUuhhHkx7+8TjneXLVRlaW9 9ywta5fQqwaEvIF3DQVnuy7D8uAmRIT/jumYnZ2SsHNrf7mBZaEBqYwaTeKidRJIgT7kdIPyoL3+W CrJlAyatuRRW8/Iko5xqIcfH5iVvul4vTnHRoGDpdqeDvpP6GLkb6HUHJyPyvNzJtMZM=; Received: from vas by admin.sibptus.ru with local (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lCCYm-000Fug-Ty for pgsql-admin@lists.postgresql.org; Wed, 17 Feb 2021 09:27:24 +0700 Date: Wed, 17 Feb 2021 09:27:24 +0700 From: Victor Sudakov To: pgsql-admin@lists.postgresql.org 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: [dd] > > You cannot run the actual scan on the replica, no. But it can be set to run > against the replica and just report the statistics so you can have a cron > set up to always run on the given system in case of failover. The > "--recovery_mode_norun" can be set so it will only run if the target system > is actually a primary. > > I could possibly see about letting this actually run against the replica, > however this can be a rather long running transaction depending on the size > of the tables involved. You can set the "--commit_rate" to avoid some of > that, but if you have really large tables, it can still run quite long. So > this sort of check is really best run against the primary to avoid issues > around having to allow long running queries on the replica (delayed > replication or even worse bloat buildup). If you have a dedicated replica for OLAP, even one running from a WAL archive (not from a replication slot), this is not an issue. So running pg_bloat_check against a replica would be very useful for some of us. -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/