Re: Question about COPY to/from

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: emilu(at)encs(dot)concordia(dot)ca
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about COPY to/from
Date: 2006-02-21 18:16:59
Message-ID: 1140545819.5777.11.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2006-02-20 at 16:39, Emi Lu wrote:
> Hello,
>
> We have millions of record and would like to insert into a table. I
> remebered people mentioned that "COPY" is the most effecient way to
> insert data, right? If not, which is it, pg_restore?

Take a look inside a pg_dump output and guess what you'll find... Lots
and lots of copy commands.

>
> By the way, does it have to be superuser to run copy to and from?

Take a look in a pg_dump file again. You'll see constructs something
like this:

COPY config (conf_name, conf_value) FROM stdin;
o_cur_version 1.2.5
o_board_title My PunBB forum
o_board_desc Unfortunately no one can be told what PunBB is - you
have to see it for yourself.
o_server_timezone 0
o_time_format H:i:s
\.

So, no. You don't have to be a super user to use COPY, as long as
you're reading from STDIN and not a file.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thies C. Arntzen 2006-02-21 18:39:38 TSearch2 from HEAD UTF8 German Compunds.
Previous Message Karsten Hilbert 2006-02-21 16:51:13 Re: How to specify infinity for intervals ?