Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade
Date
Msg-id ZmCbbi8v8J1H1HfK@nathan
Whole thread Raw
In response to Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade  (Ranier Vilela <ranier.vf@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade
Next
From: Matthias van de Meent
Date:
Subject: Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade