On Wed, 2005-12-21 at 16:23 +0000, Simon Riggs wrote:
> Writing docs now.
Here's the docs...
Hopefully that explains everything a little better....but this doc patch
contains a ref to the as yet unapplied --single-transaction patch, but
also explains why that patch exists also.
[Patch via doc/src/sgml/ref rather than from tree top]
Best Regards, Simon Riggs
Index: copy.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v
retrieving revision 1.70
diff -c -r1.70 copy.sgml
*** copy.sgml 15 Oct 2005 20:12:33 -0000 1.70
--- copy.sgml 21 Dec 2005 17:04:08 -0000
***************
*** 26,31 ****
--- 26,32 ----
[ [ WITH ]
[ BINARY ]
[ OIDS ]
+ [ LOCK ]
[ DELIMITER [ AS ] '<replaceable class="parameter">delimiter</replaceable>' ]
[ NULL [ AS ] '<replaceable class="parameter">null string</replaceable>' ]
[ CSV [ HEADER ]
***************
*** 39,44 ****
--- 40,46 ----
[ BINARY ]
[ HEADER ]
[ OIDS ]
+ [ LOCK ]
[ DELIMITER [ AS ] '<replaceable class="parameter">delimiter</replaceable>' ]
[ NULL [ AS ] '<replaceable class="parameter">null string</replaceable>' ]
[ CSV [ HEADER ]
***************
*** 152,157 ****
--- 154,176 ----
</varlistentry>
<varlistentry>
+ <term><literal>LOCK</literal></term>
+ <listitem>
+ <para>
+ An ExclusiveLock will be taken on the table prior to execution. This will
+ prevent concurrent writes to the table, as well as preventing
+ <command>VACUUM</command>, <command>CREATE INDEX</command> and other DDL
+ commands.
+ </para>
+ <para>
+ With <command>COPY FROM</command> this option can be used to greatly
+ increase performance of data loading, in certain conditions.
+ (see Notes below).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><replaceable class="parameter">delimiter</replaceable></term>
<listitem>
<para>
***************
*** 332,337 ****
--- 351,378 ----
happened well into a large copy operation. You may wish to invoke
<command>VACUUM</command> to recover the wasted space.
</para>
+
+ <para>
+ With <command>COPY FROM</command> the <option>LOCK</option> is designed
+ to increase performance of data loads when no indexes are present and
+ the server does not have archive_command set. When those pre-conditions
+ are met, <command>COPY FROM</command> will not write WAL records for the
+ data being loaded. This will greatly increase performance for large data
+ loads. An ExclusiveLock is taken to prevent concurrent writes during this
+ operation. The <option>LOCK</option> option is available for
+ <command>COPY TO</command> also, but in that case does nothing to increase
+ performance.
+ </para>
+
+ <para>
+ If the <command>COPY FROM</command> command is issued in the same
+ top level transaction as the command that created the target table, then
+ performance will also be enhanced, with or without the <option>LOCK</option>
+ option. This optimization will greatly enhance the speed of data recovery
+ from a pg_dump file or software upgrades that required a re-initdb. You can
+ take advantage of this easily using the <option>--single-transaction</option>
+ option on <command>psql</command> or <command>pg_restore</command>.
+ </para>
</refsect1>
<refsect1>
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org