postgresql/src/backend
Robert Haas 9c08aea6a3 Add new block-by-block strategy for CREATE DATABASE.
Because this strategy logs changes on a block-by-block basis, it
avoids the need to checkpoint before and after the operation.
However, because it logs each changed block individually, it might
generate a lot of extra write-ahead logging if the template database
is large. Therefore, the older strategy remains available via a new
STRATEGY parameter to CREATE DATABASE, and a corresponding --strategy
option to createdb.

Somewhat controversially, this patch assembles the list of relations
to be copied to the new database by reading the pg_class relation of
the template database. Cross-database access like this isn't normally
possible, but it can be made to work here because there can't be any
connections to the database being copied, nor can it contain any
in-doubt transactions. Even so, we have to use lower-level interfaces
than normal, since the table scan and relcache interfaces will not
work for a database to which we're not connected. The advantage of
this approach is that we do not need to rely on the filesystem to
determine what ought to be copied, but instead on PostgreSQL's own
knowledge of the database structure. This avoids, for example,
copying stray files that happen to be located in the source database
directory.

Dilip Kumar, with a fairly large number of cosmetic changes by me.
Reviewed and tested by Ashutosh Sharma, Andres Freund, John Naylor,
Greg Nancarrow, Neha Sharma. Additional feedback from Bruce Momjian,
Heikki Linnakangas, Julien Rouhaud, Adam Brusselback, Kyotaro
Horiguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others.

Discussion: http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com
2022-03-29 11:48:36 -04:00
..
access Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
bootstrap pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
catalog Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
commands Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
executor IS JSON predicate 2022-03-28 15:37:08 -04:00
foreign Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
jit IS JSON predicate 2022-03-28 15:37:08 -04:00
lib dshash: Add sequential scan support. 2022-03-10 12:57:05 -08:00
libpq Add system view pg_ident_file_mappings 2022-03-29 10:15:48 +09:00
main Fix collection of typos in the code and the documentation 2022-03-15 11:29:35 +09:00
nodes IS JSON predicate 2022-03-28 15:37:08 -04:00
optimizer Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
parser IS JSON predicate 2022-03-28 15:37:08 -04:00
partitioning Fix misuse of "const" qualifier. 2022-02-13 19:20:56 -05:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster pgstat: fix function name in comment. 2022-03-22 08:15:40 -07:00
regex Call pg_newlocale_from_collation() also with default collation 2022-01-20 09:50:18 +01:00
replication Use has_privs_for_roles for predefined role checks 2022-03-28 15:10:04 -04:00
rewrite Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Fix various typos, grammar and code style in comments and docs 2022-01-25 09:40:04 +09:00
storage Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
tcop Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
tsearch Update copyright for 2022 2022-01-07 19:04:57 -05:00
utils Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00