Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEu7M-004ewy-SU for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2024 17:08:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sEu7L-009vUo-KN for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2024 17:08:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEu7L-009vUf-AX for pgsql-hackers@lists.postgresql.org; Wed, 05 Jun 2024 17:08:07 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sEu7E-003bnn-VL for pgsql-hackers@postgresql.org; Wed, 05 Jun 2024 17:08:06 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3749a160512so35065ab.0 for ; Wed, 05 Jun 2024 10:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717607280; x=1718212080; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WVLeGSa74+YhOSOWFsNBE6j01zRLI4kYu413LETrDy4=; b=CodvlpVuKnM3JtiLYZn9fyTuFlOpwaLtF4FOHZMK0HpNA3+7hidS/llwwKD76bCyfI 8091X7TX19ZkzRgsEU1Cws5iAMxRyhthkAvjrWZXMC0bB372WhTXyI1aiq1LOAgcr7Xz IKW4hMT430XNozy7jg1si0P5BQi2d/+W9rPM7iRXbifHfDeWIELRpZyDkQqltXK5/Cgu xQPMIFqx9Soi748xms/FYO4HUMEfbYruKfkX0G66SOgdC0BkfNwv3Mjv5X5SQe8VTrgi H1DiDqus/qIXrZ8gQ8u3sisz29kKktumwz1f2QEIf+CQ8LQ4C4UwW0eSFAVqgEDxt0W4 Vg4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717607280; x=1718212080; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WVLeGSa74+YhOSOWFsNBE6j01zRLI4kYu413LETrDy4=; b=QUZN84ab//uT5S8Z55d89LF/igsoOV4ShLJ5MvJltHI3MtGx19zc5lWZr9XFLIrHCl 1P6OUSgXFIeuoY/PY2SwVa9U8erFEI634dNhGi9xyjoekEuodmPBFyZrWvssTSJRSq7d NCCHHKmwziT2LoQGP4ZLFOzSVcUXduRtx0Aq82/3NPCCN58CvgeEeLiZs7x+2Wav4rDF vI+zllaivood5CkKR5htATw1iYDivlqMCzcKAsA11MLCCikivbzdZpYPxdvKLziH5+BR CKnJuHYhnajf+WNW8QqNPGmSvST6saVT9h2mWRL5tSRIjWhjrZiM+Qa1izmsK5Gza7ET pkrQ== X-Gm-Message-State: AOJu0YyItOxb9Lb9n/DD13h785o3IB+MCeLjyXac7FfDQjXObumxlRKI CSr6b3SwtKRLW3JpebluzyCHZndQlQMLEthGew9x1w0/RclBDkZC X-Google-Smtp-Source: AGHT+IHguoWv/AYnaHsOkFsaWT0GMOLO6BYii9ZpHe/KqPBS9g5B8BXvERZaT31z8Xxl6bv96W6zxw== X-Received: by 2002:a92:2908:0:b0:374:6431:7472 with SMTP id e9e14a558f8ab-374b9801f73mr1740945ab.15.1717607280154; Wed, 05 Jun 2024 10:08:00 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-374adfc10bbsm6723935ab.54.2024.06.05.10.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 10:07:59 -0700 (PDT) Date: Wed, 5 Jun 2024 12:07:58 -0500 From: Nathan Bossart To: Ranier Vilela Cc: pgsql-hackers@postgresql.org Subject: Re: use CREATE DATABASE STRATEGY = FILE_COPY in pg_upgrade Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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