Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade
Date: 2024-06-05 17:07:58
Message-ID: ZmCbbi8v8J1H1HfK@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 05, 2024 at 01:47:09PM -0300, Ranier Vilela wrote:
> Why not use it too, if not binary_upgrade?
>
> else
> {
> appendPQExpBuffer(creaQry, "CREATE DATABASE %s WITH TEMPLATE = template0
> STRATEGY = FILE_COPY",
> qdatname);
> }
>
> It seems to me that it also improves in any use.

Well, if that is true, and I'm not sure it is, then we should probably
consider changing the default STRATEGY in the server instead. I haven't
looked too deeply, but my assumption is that when fsync is disabled (as it
is when restoring schemas during pg_upgrade), both checkpointing and
copying the template database are sufficiently fast enough to beat writing
out all the data to WAL. Furthermore, in my test, all the databases were
basically empty, so I suspect that some CREATE DATABASE commands could
piggy-back on checkpoints initiated by others. This might not be the case
when there are many objects in each database, and that is a scenario I have
yet to test.

--
nathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-06-05 17:28:42 Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade
Previous Message Ranier Vilela 2024-06-05 16:47:09 Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade