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-27 19:48:17
Message-ID: CANzqJaC7WgnV74NnLraw_2siNFa6Jkb2d+S7Y9nucAxJpZnaeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sat, Jul 27, 2024 at 10:27 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Fri, 2024-07-26 at 17:57 -0700, Wells Oliver wrote:
> > Maybe it's an old wives' tale, but I swear I've read a recommendation to
> turn
> > autovacuum off when doing pg_restore into a new server.. Would it make
> the
> > restore faster? I think I've restored and then run vacuumdb + analyze,
> > but I wanted to check.
>
> 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).

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

I wouldn't recommend turning autovacuum off, because it is a dangerous thing
> to do. If you forget to enable it, your database will be in big trouble.
>

You can't forget to enable autovacuum when it's in the same script as the
pg_restore.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2024-07-27 20:05:52 Re: Faster pg_resore with autovacuum off?
Previous Message David G. Johnston 2024-07-27 18:35:39 Re: Restoration query