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 1mccSB-0003kR-2I for pgsql-docs@arkaria.postgresql.org; Mon, 18 Oct 2021 23:54:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mccS9-0005lv-SZ for pgsql-docs@arkaria.postgresql.org; Mon, 18 Oct 2021 23:54:01 +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 1mccS9-0005lc-Ls for pgsql-docs@lists.postgresql.org; Mon, 18 Oct 2021 23:54:01 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mccS7-0001VV-8M for pgsql-docs@lists.postgresql.org; Mon, 18 Oct 2021 23:54:00 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 25A503200FA2; Mon, 18 Oct 2021 19:53:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 18 Oct 2021 19:53:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=RIkk/4cMl5e1mJv+ntELjFpZtu48qx4y/XbkvDQpCSw=; b=HaVSVC5z k41wYxnWyDYO2LfHMN4VrhKkzmpzqpyH8AsjrAFTZjZWL9PyriRP03Qirc65Gj/7 C8czPK+evI2qo0XlT27BfRxK8HUhKn5Wky1UW8YZrUWYtWEXGw+cAraV8dRponIT fY6G0XZz7BQfMzCNFSVJLc18vyeBArxZ0OImx05pNeGUk3FByKb6FyC3dPZNIPHg RBoKKUaM/XmYAdL497YadjJ+1MtLbnwYGGJsJgObs7VpApkIJuZW2awxOHvAtAnZ 8u3Z1xLJhd/seo15WjycnG3rJyW3hR8Vdbz6Or25sOZ8FNgUAqqaHWYF12+ffFTy nZkvRy23rCMpjQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvuddgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Oct 2021 19:53:56 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 711462A0804; Mon, 18 Oct 2021 20:53:52 -0300 (-03) Date: Mon, 18 Oct 2021 20:53:52 -0300 From: Alvaro Herrera To: "David G. Johnston" Cc: Euler Taveira , "nikolai.berkoff" , "pgsql-docs@lists.postgresql.org" Subject: Re: vacuumdb --analyze-in-stages Message-ID: <202110182353.6lbwp4redjd2@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Oct-18, David G. Johnston wrote: > On Mon, Oct 18, 2021 at 4:02 PM Alvaro Herrera > wrote: > > Given that the first stage uses statistic target=1, running this option > > in a database with any stats at all is probably a bad idea. > > Add the word "only"? > > This option is only useful to analyze a database... Maybe this is sufficient, since it would drive people away from trying to do anything else than help upgrades with it. > Beyond that maybe adjust the procedure description to include a comment > that we don't actually skip tables that already have a higher statistics > target than the current pass would apply. (can we do this?) Hmm, vacuumdb can certainly query the catalogs to see what we have and skip tables for which we have more than that number, perhaps with a query based on this number select tablename, max(coalesce(cardinality(histogram_bounds), cardinality(most_common_freqs))) - 1 from pg_stats group by tablename; (and of course *don't* skip tables in the final stage, since the stored stats could be obsolete.) > "Run several (currently three) stages of analyze with different > configuration settings, to produce usable statistics faster. The first of > these stages will remove any existing statistics even if they use a larger > statistic target configuration." .. yeah, this is another option. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/