@@ -1860,10 +1860,15 @@ make_template0(FILE *cmdfd)
18601860 * objects in the old cluster, the problem scenario only exists if the OID
18611861 * that is in use in the old cluster is also used in the new cluster - and
18621862 * the new cluster should be the result of a fresh initdb.)
1863+ *
1864+ * We use "STRATEGY = file_copy" here because checkpoints during initdb
1865+ * are cheap. "STRATEGY = wal_log" would generate more WAL, which would
1866+ * be a little bit slower and make the new cluster a little bit bigger.
18631867 */
18641868 static const char * const template0_setup [] = {
18651869 "CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false OID = "
1866- CppAsString2 (Template0ObjectId ) ";\n\n" ,
1870+ CppAsString2 (Template0ObjectId )
1871+ " STRATEGY = file_copy;\n\n" ,
18671872
18681873 /*
18691874 * template0 shouldn't have any collation-dependent objects, so unset
@@ -1906,9 +1911,12 @@ make_postgres(FILE *cmdfd)
19061911{
19071912 const char * const * line ;
19081913
1909- /* Assign a fixed OID to postgres, for the same reasons as template0 */
1914+ /*
1915+ * Just as we did for template0, and for the same reasons, assign a fixed
1916+ * OID to postgres and select the file_copy strategy.
1917+ */
19101918 static const char * const postgres_setup [] = {
1911- "CREATE DATABASE postgres OID = " CppAsString2 (PostgresObjectId ) ";\n\n" ,
1919+ "CREATE DATABASE postgres OID = " CppAsString2 (PostgresObjectId ) " STRATEGY = file_copy ;\n\n" ,
19121920 "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n\n" ,
19131921 NULL
19141922 };
0 commit comments