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 1l8iUB-0006i9-Um for pgsql-general@arkaria.postgresql.org; Sun, 07 Feb 2021 11:44:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l8iUA-0004o6-TR for pgsql-general@arkaria.postgresql.org; Sun, 07 Feb 2021 11:44:14 +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 1l8iUA-0004nz-Le for pgsql-general@lists.postgresql.org; Sun, 07 Feb 2021 11:44:14 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l8iU2-00018z-OI for pgsql-general@lists.postgresql.org; Sun, 07 Feb 2021 11:44:14 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id B92784421; Sun, 7 Feb 2021 12:44:04 +0100 (CET) Date: Sun, 7 Feb 2021 12:44:04 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: vacuumdb not letting me connect to db Message-ID: <20210207114404.GA27747@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <367051164.1780361.1612460095810@mail.yahoo.com> <9645df52-2cdc-9e9e-b43c-d388c1aa7951@gmail.com> <0f3e4fa7-b028-f277-b3d2-114731a6c223@gmail.com> <7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com> <2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org> <2a5e2391-a627-fb3b-001e-ec75f8267e10@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline In-Reply-To: <2a5e2391-a627-fb3b-001e-ec75f8267e10@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-02-06 12:54:11 -0600, Ron wrote: > On 2/6/21 6:06 AM, Atul Kumar wrote: >=20 > Hi Gavan, >=20 > Thanks for providing the details, I need more clarification on this a= s how > should I analyze that what should be ideal no. of connections should = we set > to avoid IO overhead based on the available hardware resources. > How to do this calculation ? >=20 >=20 >=20 > Run "iotop -o -u postgres", and then compare that with the total bandwidth > available to the system.=A0 If it's (even almost) saturated, then everyth= ing else > will be starved. >=20 > The "--jobs=3D" value should AT MOST be some *small* multiple of the numb= er of > CPUs (like 1x, 1.5x or maybe 2x if the core count is low, and nothing els= e is > running on the system. While this is generally good advice, Atul reported earlier in the thread that CPU consumption is only 1 to 4 %. So the problem is clearly not related to CPU usage, but very probably (as some have already noted) on I/O. You could use a similar rule of thumb for disks ("a small multiple of the number of disks") but with SSDs this might not be very accurate. I think the only method to get to the optimal number of vacuums that can be run in parallel is to determine it experimentally: 300 is clearly too high. So try 150, 75, 37, etc. For each number try to do some other work - is the performance acceptable? If yes, note the time until vacuum is finished. FInally among those where the performance was acceptable choose the value which was fastest. (Note: If you do this on the same database, subsequent runs will benefit =66rom work already done, so the take the results with a grain of salt). hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmAf0n8ACgkQ8g5IURL+ KF3vAA/+Iuu90RQQz+f3BZ3xLRpP3flBlIt2tHj9ejBs/c9nyOF+2mxXUaUoFAJa VMurEtU+6I5ySUS8Au8M+sGK8qf2emmPcHElKRqPFMj9UCNBVK8wi7+aq+6TR3k8 O5eEhhrNMwIBZbvj2QDbEJOoVja8DePFIZyFAVj+B+XqAYfwsb0qxkBw8nSOtNnF BVowoFJouqTxSiKpOpxgnx0UOAVBVms5jbawusiuyQ88f35fE59Dj0ELyKUEVrbT VrfZKmXl7Jj5CHcb9tgT5gA8QnhdS2Lxbp+OZUGXLKQuYu0FuyaUwzJxEFlytxw+ ImUFDRLf1vF6EgYiVxhQ9YJSvmt49U4A8mt5jX7u5fjRobJBSasETvvv+W/VYOqL hV0Fjm09FzNapYVbncwt4pqK3at/Zt10Gy/C9IJ1+lrA+51fQLHI6cIULDjdwJV0 KE+htPNte9obuKNOpyK/alVcivTEprUhn6bkXaHBKFL8m4fZGSfOWhNTyDB9roy+ r88Djf72g1SuPtmn3DpPzEUwKypUdop29tuqe/5ErXgfAwmhs0n2dJXZ+rGnZVjE faZxqYSnYcgU8ix68vLsKlKe6I8MtsMuXQiyg+4vIi4Y3GQdyfPsXV9rHJgurUUd kBeH4I/Cu8p/9JQK7Aw0SutZQp/vh5+I8v4fzYofERvYnWcpnRA= =QmgW -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe--