Re: Faster pg_resore with autovacuum off?

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Faster pg_resore with autovacuum off?
Date: 2024-07-28 12:42:31
Message-ID: CANzqJaDOamjnpggH6W4iT5DvnjKjpJGRBYFh-U_pS=zh5jCYaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sun, Jul 28, 2024 at 8:34 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Sat, 2024-07-27 at 15:48 -0400, Ron Johnson wrote:
> > > If your machine is too weak to handle the combined workload of restore
> +
> > > autovacuum, that might get you something. Otherwise, you are just
> cheating:
> > > the restore might be faster, but the database is not usable before
> autovacuum
> > > and autoanalyze have proessed all restored tables.
> >
> > I 100% disagree with this: autovacuum is not necessary during pg_restore
> > (presuming there's only one database in the instance).
>
> It is not necessary during restore, but it is necessary if you want to use
> the database after the restore. Well, you can manually VACUUM and ANALYZE
> the
> database, but why not do it automatically?
>
> I think that there are very few good reasons to ever disable autovacuum,
> and
> a restore is not among them.
>

My experience is that autovacuum=off pg_restore -Fd -j$BigNum + vacuumdb
-Zj$BigNum is faster than letting autoanalyze=on pg_restore -Fd -j$BigNum.

> > Heck, it might not even be vital if you carefully monitor the other
> databases
> > in the instance.
>
> ?
>

Tables in a freshly vacuum database won't need vacuuming again "for a
while" unless they're really, really busy. Analyzing is a different story,
but targeted manual analyzes work just as well.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ron Johnson 2024-07-28 12:47:25 Re: Faster pg_resore with autovacuum off?
Previous Message Laurenz Albe 2024-07-28 12:40:32 Re: Faster pg_resore with autovacuum off?