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 1p6jJX-0008Tm-1v for pgsql-bugs@arkaria.postgresql.org; Sun, 18 Dec 2022 02:22:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p6jJU-0007mY-Fq for pgsql-bugs@arkaria.postgresql.org; Sun, 18 Dec 2022 02:22:04 +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 1p6jJS-0007kD-Kq for pgsql-bugs@lists.postgresql.org; Sun, 18 Dec 2022 02:22:04 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6jJO-0004Tl-7X for pgsql-bugs@lists.postgresql.org; Sun, 18 Dec 2022 02:22:01 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id AF50E5C0091; Sat, 17 Dec 2022 21:21:53 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sat, 17 Dec 2022 21:21:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=1671330113; x=1671416513; bh=DJ9UPjDnxy Y7HOsWVcrG2KVfOF7mFYkVskUP1F49mB4=; b=ADYjn6Y6opHU6198U14sKThetK 7Wkvjv5PWiyc5AbeQsBU8J+LgZdqK7RMPybGr4K5o4k6ytoiO7GnPY5P91BUslBH M95k/Rq/PvOmihrb2q5VRRoIsoXFiZgv+GIv3cHJNef01fd9oZKpDZbNrSuwyCdx YDrYvwt/MOdp023gpGEaogfG8LhVSL4orXUGTkrsV0etzIQa+VDWXIMMzSGJW8jQ 8N4w9yJ85REKBkJAVL+tPhFPlnIxw/tPYSRbY5GYk8kZe9gGv989GBfaMN8sKLI7 9eVeKtlcfxMdjTxknM9BjKNOWItXOfw81pNjxBYpNzODHOPfcivGpGk7/mjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1671330113; x=1671416513; bh=DJ9UPjDnxyY7HOsWVcrG2KVfOF7m FYkVskUP1F49mB4=; b=Vc4vDvjNnJKJI4aMnlgfTh0n3N91xmS7hQ+FvQ0tpboo TSp5YEBqeICG5xRzn6BpQFX6vNNgQnnGLNbbrjBE5sTd7T7ljfc8nX+jPTfzT10S QbID8YAWqzilhMyMd3sdu5drqpNTpA0OtfYJ4Rw4bCDYEZkMAFNJ8QzGZGntHaWp 24mpch5RGLPxxmhx50mraU81UNtv2vZUQAAdtwlD/Z9nnIN0Gxclwzvy8G0sEZ4G vUBm1mlo+OvmsSfHuNJ2SzVPODphoM5YEtwCuXE0dCbTuZ+KNp1wvs9ZZ6raWa/h rtJ/vbl5UuO2+t+3xpRP6+aT9VB8LPi9gT7B7uc4CQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtgdegfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Dec 2022 21:21:51 -0500 (EST) Date: Sun, 18 Dec 2022 11:21:47 +0900 From: Michael Paquier To: Tom Lane Cc: postgresql@taljaren.se, pgsql-bugs@lists.postgresql.org, Peter Geoghegan Subject: Re: BUG #17717: Regression in vacuumdb (15 is slower than 10/11 and possible memory issue) Message-ID: References: <17717-6c50eb1c7d23a886@postgresql.org> <3439037.1671130590@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bY3Hbk/q2oUqIsJA" Content-Disposition: inline In-Reply-To: <3439037.1671130590@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --bY3Hbk/q2oUqIsJA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Dec 15, 2022 at 01:56:30PM -0500, Tom Lane wrote: > * To fix vacuumdb properly, it might be enough to get it to > batch VACUUMs, say by naming up to 1000 tables per command > instead of just one. I'm not sure how that would interact > with its parallelization logic, though. It's not really > solving the O(N^2) issue either, just pushing it further out. I have been thinking about this part, and using a hardcoded rule for the batches would be tricky. The list of relations returned by the scan of pg_class are ordered by relpages, so depending on the distribution of the sizes (few tables with a large size and a lot of table with small sizes, exponential distribution of table sizes), we may finish with more downsides than upsides in some cases, even if we use a linear rule based on the number of relations, or even if we distribute the relations across the slots in a round robin fashion for example. In order to control all that, rather than a hardcoded rule, could it be as simple as introducing an option like vacuumdb --batch=N defaulting to 1 to let users control the number of relations grouped in a single command with a round robin distribution for each slot? -- Michael --bY3Hbk/q2oUqIsJA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmOeeToACgkQnvQgOdby QH1/1A//f/tSiADj3mhbzkKT9bHmKfvN80EC7eRqstK3PhWXeRlbgkBiGZBwlPta UtROCfOnw0sCaJZ1nhV0oq/XYQ3bLC+QreHsEXBQCxUM6PeX/KgbED0H51dds0Md hRfgxMqtR0AlT7KAOrt+MUKLM1SV7nEEzcd8yy409mfkGC5aJxZAQqb86ICsAOUT 9k+dLtPeVFeIwBC8yxYqJ7/uT5I1FITaQIaT+t0TOIB4+IHVJUTCfK9pZw/ylfAi bs6xaPQZLAg0FwFoftvF6QoQiIW5RP+01GK8df8P03vdPK6A4OXaBP3TN17gMRbV 8jKZieSeBL2uqBZ/OIFwdvV9pb2sJapZi1Tjwt23Nxw38+Vrn/S3OsRPgcEsfOJR wUAR2nBRhW6NP151ZfoB55Cotm4+W6HOYcztFe1Us27/cEtpl4Vfnx2JuJqp1J+j 2mC6biAlH1r21EWAvMFR05/Gf5y/W9zwy2uA0hytTFXCWA4cGAOoRyLX5pYJM8tz 8PD1fKbkYylxHBx1H8euHHnyNKWcJYWWBUJE/bkGQuFNYc1xGACQso7TZUSFwUgr r0+IJMVV8YTyY9ZwwLh5OqqE+0EMFwOOP/2MI1GCEzSsBBYUZEeMCIcra/4/ssOV OoTcUpxcVjBbJz0Okn4Qx4EMxJJLUEM8knbBgMgc+npjhEE17W4= =hcHb -----END PGP SIGNATURE----- --bY3Hbk/q2oUqIsJA--