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 1pkGrN-0004NO-5w for pgsql-committers@arkaria.postgresql.org; Thu, 06 Apr 2023 04:04:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pkGrL-00074N-MV for pgsql-committers@arkaria.postgresql.org; Thu, 06 Apr 2023 04:04:27 +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 1pkGrL-00074E-F9 for pgsql-committers@lists.postgresql.org; Thu, 06 Apr 2023 04:04:27 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pkGrJ-0004MV-7P for pgsql-committers@lists.postgresql.org; Thu, 06 Apr 2023 04:04:26 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 901EC320092E; Thu, 6 Apr 2023 00:04:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 06 Apr 2023 00:04:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1680753863; x=1680840263; bh=QW S80coZ5TX16Sgt5UgMCQ6iKxF+B5zzMsNVFapaYi0=; b=LgYqiwKljZe48bmAP5 qrwxJDaO/FW7Cr4tE8CMcb8f3FFzi/+R3s/j1M/5UA1YE7uSbPmMmAHtZxjhb3BI YqBwsxQ6TLjcGxYXYeREdapFroKnTJYTNMvY8uQ8Zje+rlEsu7ECh/ujI8lo4kZR P4bizq0eePsXRgjP9SxV3RJF115B4fsGAJi4Wx8ehv/3WinkjfJu2ODmGsa7paUX QDs9+42GJMoa60chMa7HV67P8qvRVsWzsJ7hWUB2OYgNkF7hDwcdIfjjYNqTyNtS gJD/L8s1rzPFeF4jN7XJOFepXPg4rZ/EWmzsC/Vg5PPhZVjBk4eCkxLNmAqw8HXj uKQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680753863; x=1680840263; bh=QWS80coZ5TX16 Sgt5UgMCQ6iKxF+B5zzMsNVFapaYi0=; b=otSIqHlTKPBfngrhOcYBosVr89ozj U9xCpvo5N06+Yw643W1UJ7Jw1jNOWLTh9AUahDF3fJ/RmZRrl7kbpoKO8nmgZz1b lBY7j4Jqdq7j2izLzowjfFu0pcvWXW4AQ5tHmr5fmETfHGwY8ED6J/6FPfrJQSb1 AcvHyorCTNsWx0U2ILg+jSfCgG/iM99OLmX2M4P2tJozfCB1tmwAXcAz0DJlUsG9 o5TGwePEoTdHdUUZdWFfFEY/JxW3860GdLQ40afxaGstcls5+DiVqrGyWImwoIzP e4QUd2WujZ2Vz7G5jJjlURWeU+oNS31cjaXyt8WWTcSX+sc2pg5uS9M8A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejvddgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Apr 2023 00:04:21 -0400 (EDT) Date: Thu, 6 Apr 2023 13:04:17 +0900 From: Michael Paquier To: David Rowley Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Move various prechecks from vacuum() into ExecVacuum() Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="r4F9Fd/o/d2dP7MY" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --r4F9Fd/o/d2dP7MY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi David, On Thu, Apr 06, 2023 at 03:45:19AM +0000, David Rowley wrote: > Move various prechecks from vacuum() into ExecVacuum() >=20 > vacuum() is used for both the VACUUM command and for autovacuum. There > were many prechecks being done inside vacuum() that were just not relevant > to autovacuum. Let's move the bulk of these into ExecVacuum() so that > they're only executed when running the VACUUM command. This removes a > small amount of overhead when autovacuum vacuums a table. >=20 > While we are at it, allocate VACUUM's BufferAccessStrategy in ExecVacuum() > and pass it into vacuum() instead of expecting vacuum() to make it if it's > not already made by the calling function. To make this work, we need to > create the vacuum memory context slightly earlier, so we now need to pass > that down to vacuum() so that it's available for use in other memory > allocations. I have just seen this commit, and I am pretty sure that the checks have been placed in vacuum() to guard against incorrect option manipulations in the context of an autovacuum building the relations, so you are making this code weaker with the cross-checks it had, IMO. This is particularly relevant in some areas with toast relations, for example, because autovacuum handles the toast and their parents separately, contrary to ExecVacuum() that would group them together by default. My 2c. -- Michael --r4F9Fd/o/d2dP7MY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmQuRMEACgkQnvQgOdby QH2YqA/+O1attOgUcECOD22o3DsDybtdCiy+uP+FlqFxk1VzzJqUEzTjfDQ6L9YE Mg5LtntLjoxY/ER+RTE3Eg+xTqSevfm1Fnl98BCMS/yMxuuiWTwwyfna4eLphiii adzlvQdITIeSS3M1bbeX95O80Eh4d8Sw3PGE/wWACrAy1NRScR00CIpnwx5YNYHP lz24rfkGWdVQqurTtZjP1Al5WNLme6xD1xEq304PoAmnSxo0sqot9TMJY6k/du2v 7WU7aJNn7O9gHu5KMpUV/9ZJlSDegcDZj2LQZvWwulu+aJhnWYs2ycvI5WVA89xO QRQ5iGqIryhK4gxeELjpl6KaFIxqagxL62DtXstHgkQEHQL8vv36kA72j6Af0VEL YvPe1dYS6CNfuYo+AkWXWXdE9R8m9tCKv5QxDWFmXiI1wKfaQ8YWfXr8MBpmIX/9 eKWELVvhGOZUe4r7nozQgrDNAazW/TYTzxpJXMB5A3+jHt68PL0vGZ1g7aeqQ9P1 WxBqyQ7z2ZitI1BIuqVE0E+4pLMelCBF2S+xysAL17nnNqrGdtJytHMQ629ehdnN 1aEofnOoHrPn5Y68evoARG1HnNnzrWIJ8lxgdzrakr6docJTiXIyqRT9P6GjPvgg vsM+loFexf3voOXbLrs4zbeD1k2+ERiG9VprEMdCKKzf9czZar4= =bTKE -----END PGP SIGNATURE----- --r4F9Fd/o/d2dP7MY--