mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
COPY FREEZE and mark committed on fresh tables.
When a relfilenode is created in this subtransaction or a committed child transaction and it cannot otherwise be seen by our own process, mark tuples committed ahead of transaction commit for all COPY commands in same transaction. If FREEZE specified on COPY and pre-conditions met then rows will also be frozen. Both options designed to avoid revisiting rows after commit, increasing performance of subsequent commands after data load and upgrade. pg_restore changes later. Simon Riggs, review comments from Heikki Linnakangas, Noah Misch and design input from Tom Lane, Robert Haas and Kevin Grittner
This commit is contained in:
@ -34,6 +34,7 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
|
||||
|
||||
FORMAT <replaceable class="parameter">format_name</replaceable>
|
||||
OIDS [ <replaceable class="parameter">boolean</replaceable> ]
|
||||
FREEZE [ <replaceable class="parameter">boolean</replaceable> ]
|
||||
DELIMITER '<replaceable class="parameter">delimiter_character</replaceable>'
|
||||
NULL '<replaceable class="parameter">null_string</replaceable>'
|
||||
HEADER [ <replaceable class="parameter">boolean</replaceable> ]
|
||||
@ -181,6 +182,28 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>FREEZE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies copying the data with rows already frozen, just as they
|
||||
would be after running the <command>VACUUM FREEZE</> command.
|
||||
This is intended as a performance option for initial data loading.
|
||||
Rows will be frozen only if the table being loaded has been created
|
||||
in the current subtransaction, there are no cursors open and there
|
||||
are no older snapshots held by this transaction. If those conditions
|
||||
are not met the command will continue without error though will not
|
||||
freeze rows.
|
||||
</para>
|
||||
<para>
|
||||
Note that all sessions will immediately be able to see the data
|
||||
once it has been successfully loaded. This violates the normal rules
|
||||
of MVCC visibility and by specifying this option the user acknowledges
|
||||
explicitly that this is understood.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>DELIMITER</literal></term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user