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 1lKFGg-0006cL-IG for pgsql-committers@arkaria.postgresql.org; Thu, 11 Mar 2021 06:57: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 1lKFGf-0001CF-FC for pgsql-committers@arkaria.postgresql.org; Thu, 11 Mar 2021 06:57:57 +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 1lKFGf-0001Bj-9g for pgsql-committers@lists.postgresql.org; Thu, 11 Mar 2021 06:57:57 +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 1lKFGc-0002qS-Iv for pgsql-committers@lists.postgresql.org; Thu, 11 Mar 2021 06:57:56 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id B05E62FB6; Thu, 11 Mar 2021 01:57:52 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 11 Mar 2021 01:57:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=+EvA19eE9YOQG6v4fLL1QFUUELs shaBGC2JdJ/NXLQc=; b=u2lVK1sbKkI6K8zN79//xW8isezejQ9VZHb7lQHOuBo I9dSLNcCYAMSEWgFwK+qCeIh+TOO3WJa32D248nkFIU0mTqSnhaFo4ux5gbZBBkg Xt3texmpffNLr+fMa/HEebdjBVc4WJkeWH3m0cBI8kX8bbctOo/FfC0yqIEXnr37 iNjTVguNLcT14timpINKMuHxOCvaDM4LSCmjHOtVNKLJLipvfd/muLPQtf2xa46e iaf6v2uJWvcp1rFm8LrGKSCrXJkHBK6WEucA63B18t/IlJ9/MV6j9lbTODYZkncY S/f4FXH7jMhgUwgdTJfDNAvwanUZ0BN989lxweZqOLg== 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-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=+EvA19 eE9YOQG6v4fLL1QFUUELsshaBGC2JdJ/NXLQc=; b=HaNugu1n0l/IHRO+twr1gS 1pHO6BUvAzWQVhx1CrONJlrBEyyhdv/uG6jkl0zj267aCxNph78nYaj/2HF3tPhT brsanO2RvBGAt3EFaiThcKNZ5O2byrqRkDuw/JyHb9v426yiBF0tBc0kxpdXLiGH OD/T9zdW3scHdODmYsu2v2R5Y1BGebPkyj29axjv+LuHunwipIo8PLMovC4TDYIO mICFfSxUnZX+g7oZz6DKsXNEsGWKt/Yl2twN4BejLVatJtt8MhTdrM1gAL/8Y5Yj f6TTByVgwsLcfTUBtsqhAiN69JwcTlovRb6UuEa/4OfluQuuoZC1Aw8cfqGugOdA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudduledguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveej heehieevueeigeelteegleejleeiueeiheegvefhnecukfhppeduuddurddutddvrdduke dtrddukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 18A7924005A; Thu, 11 Mar 2021 01:57:49 -0500 (EST) Date: Thu, 11 Mar 2021 15:57:47 +0900 From: Michael Paquier To: Peter Geoghegan Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Don't consider newly inserted tuples in nbtree VACUUM. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SH6dTDpz46eiT+Cr" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --SH6dTDpz46eiT+Cr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Peter, On Thu, Mar 11, 2021 at 12:27:25AM +0000, Peter Geoghegan wrote: > The vacuum_cleanup_index_scale_factor/stats interface made the nbtree AM > partially responsible for deciding when pg_class.reltuples stats needed > to be updated. This seems contrary to the spirit of the index AM API, > though -- it is not actually necessary for an index AM's bulk delete and > cleanup callbacks to provide accurate stats when it happens to be > inconvenient. The core code owns that. (Index AMs have the authority > to perform or not perform certain kinds of deferred cleanup based on > their own considerations, such as page deletion and recycling, but that > has little to do with pg_class.reltuples/num_index_tuples.) I think that this commit has some issues that need more thoughts. The removal of vacuum_cleanup_index_scale_factor means that any=20 existing deployment of Postgres that includes at least one index using this parameter would fail in the middle of the restore during pg_upgrade, when restoring the binary dump. It seems to me that it is user-unfriendly to complain in the middle of an upgrade, as it could take time before being detected. In my opinion, it would be better to do something else. Here are three possibilities: 1) Make pg_upgrade check at its beginning if any databases to upgrade include an index with this parameter set. 2) Tweak the upgrade/restore to ignore this parameter if set. 3) Let the option live in the existing set of relation options, but just ignore it in the backend code. On top of that, you have a second issue here: a pg_dump from 14 dumping from an older server would also happily dump any indexes with=20 this parameter set, making the dump incompatible with 14. Thanks, -- Michael --SH6dTDpz46eiT+Cr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmBJv2sACgkQnvQgOdby QH18Ww/8CkL810k6AGFxpJfr+YcvT6z+6EJPVINjupY0hXYc63xRkqHSjCvZe5Ki 8PzQtwWow50SvBwmNZwg0aLLDiGN/W4mVjJiaR+ReGuefCE9IHgD8edhpkFkmmMW mDSywO9PDOH9FAoSf6rKduot0Rh6QllbVp3yGqDHj+nzrL4imyNWQEl0622yZeCb tHbcZU29BieKCs0vaadkYT6lGWRJhvx9jQgISTpMfsssszbRtkXMzBNrPp2OSa2p CmBc6THH5kRvwFxXIjSgYwxA5w+9Yt3LTgjw6lQJVO/eKMBfgqX+lUIG6+eS2BUJ J6LDdEnSIfWUKVhB9b294KqJRcADd45sTHRQoGJyTSjbGlZtXEGQ9aJB+cawZEV3 M6IyiPcVx0F7VDXyKpkbIuVB/c8srDGMj63ftbhyyctrkFR1CuxJMf2XNu7nJYPq LQXiDcs2um2r2gcs4P/pbwqNBaSNCP76LVzp60RWQ42MiK1vM78JhqXK6OOBbc3X CL5w6RUEkicdvGi9xvCThXCaazhJ9XPDfYKcUAUDh46Tsr041BlX7ZXVbN1pUROW I+ki9q40h3jCmQrVgU4R7Q8i5N+c2hgj5pqm6OZPfZFmYaJCE5yq1diNt/Ust7QF MhCakPiLsMbCH9WBmzO33X13dl+7jVnpht+Av8ja0Ytpa1ysmP8= =fdo6 -----END PGP SIGNATURE----- --SH6dTDpz46eiT+Cr--