From 8de72b66a2edcf12c812de0a73bd50b6b7d81d62 Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Sat, 1 Dec 2012 12:54:20 +0000 Subject: 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 --- doc/src/sgml/ref/copy.sgml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index b2a6dd797ce..6d34c319888 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -34,6 +34,7 @@ COPY { table_name [ ( format_name OIDS [ boolean ] + FREEZE [ boolean ] DELIMITER 'delimiter_character' NULL 'null_string' HEADER [ boolean ] @@ -181,6 +182,28 @@ COPY { table_name [ ( + + FREEZE + + + Specifies copying the data with rows already frozen, just as they + would be after running the 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. + + + 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. + + + + DELIMITER -- cgit v1.2.3