From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: vacuumdb not letting me connect to db
Date: Sun, 7 Feb 2021 12:44:04 +0100
Message-ID: <20210207114404.GA27747@hjp.at> (raw)
In-Reply-To: <2a5e2391-a627-fb3b-001e-ec75f8267e10@gmail.com>
References: <367051164.1780361.1612460095810@mail.yahoo.com>
<CA+ONtZ50t+T-RPYS-QwZx2-L+Rd9PNEniz6CqV_uOab1teRpjQ@mail.gmail.com>
<9645df52-2cdc-9e9e-b43c-d388c1aa7951@gmail.com>
<CA+ONtZ5VcPA1s5fuHb6+x4W_Nv9SrFdtDG+H3OKAiSLHgn-7Yw@mail.gmail.com>
<a988e21a-7f1c-8480-235a-1c5cf7ba6b3c@gmail.com>
<0f3e4fa7-b028-f277-b3d2-114731a6c223@gmail.com>
<7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com>
<2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org>
<CA+ONtZ7Sut_qHYgW0iyWVRFNpdh8ZhX-=XUXMSRgZ5j-gvheOA@mail.gmail.com>
<2a5e2391-a627-fb3b-001e-ec75f8267e10@gmail.com>
On 2021-02-06 12:54:11 -0600, Ron wrote:
> On 2/6/21 6:06 AM, Atul Kumar wrote:
>
> Hi Gavan,
>
> Thanks for providing the details, I need more clarification on this as 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 ?
>
>
>
> Run "iotop -o -u postgres", and then compare that with the total bandwidth
> available to the system. If it's (even almost) saturated, then everything else
> will be starved.
>
> The "--jobs=" value should AT MOST be some *small* multiple of the number of
> CPUs (like 1x, 1.5x or maybe 2x if the core count is low, and nothing else 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
from work already done, so the take the results with a grain of salt).
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: hjp-pgsql@hjp.at
Subject: Re: vacuumdb not letting me connect to db
In-Reply-To: <20210207114404.GA27747@hjp.at>
References: <367051164.1780361.1612460095810@mail.yahoo.com> <CA+ONtZ50t+T-RPYS-QwZx2-L+Rd9PNEniz6CqV_uOab1teRpjQ@mail.gmail.com> <9645df52-2cdc-9e9e-b43c-d388c1aa7951@gmail.com> <CA+ONtZ5VcPA1s5fuHb6+x4W_Nv9SrFdtDG+H3OKAiSLHgn-7Yw@mail.gmail.com> <a988e21a-7f1c-8480-235a-1c5cf7ba6b3c@gmail.com> <0f3e4fa7-b028-f277-b3d2-114731a6c223@gmail.com> <7e35e59f-364a-eb98-43ac-6c927d8757b4@gmail.com> <2FF4F45A-01AA-4AC5-9EFA-8CE6DCADA9C8@pendari.org> <CA+ONtZ7Sut_qHYgW0iyWVRFNpdh8ZhX-=XUXMSRgZ5j-gvheOA@mail.gmail.com> <2a5e2391-a627-fb3b-001e-ec75f8267e10@gmail.com> <20210207114404.GA27747@hjp.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox