[lug] question on Relational database record loading

Bear Giles bgiles at coyotesong.com
Thu Jun 1 22:32:03 MDT 2006


Lee Woodworth wrote:

>I think you mean the COPY command. For Postgresql 8.1.2
>\h LOAD displays:
>   Command:     LOAD
>   Description: load or reload a shared library file
>   Syntax:
>   LOAD 'filename'
>
>While \h COPY displays:
>   COPY tablename [ ( column [, ...] ) ]
>       FROM { 'filename' | STDIN }
>       [ [ WITH ]
>             [ BINARY ]
>             [ OIDS ]
>             [ DELIMITER [ AS ] 'delimiter' ]
>             [ NULL [ AS ] 'null string' ]
>             [ CSV [ HEADER ]
>                   [ QUOTE [ AS ] 'quote' ]
>                   [ ESCAPE [ AS ] 'escape' ]
>                   [ FORCE NOT NULL column [, ...] ]
>
>
>Haven't personally used the COPY command, so can't
>really help with the particulars.
>
You're right.  I was thinking of LOAD since I've written user-defined 
types and you need that to load your, uh, user-defined types.  In my 
case there was one 'load' statement followed by a kiloline of type and 
function declarations... but I ended up with a database that had native 
support for X.509 digital certificates and encrypted private keys.  Too 
bad that was for PostgreSQL 6.x.

I've used COPY on a few occasions.  It's faster than individual INSERT 
statements.  It's far faster.  IIRC it was something like 6x or 8x 
faster for my datasets.  Your mileage may vary.





More information about the LUG mailing list