Re: insert multiple rows - Mailing list pgsql-novice

From Andrew McMillan
Subject Re: insert multiple rows
Date
Msg-id 1020557234.15995.5.camel@kant.mcmillan.net.nz
Whole thread Raw
In response to insert multiple rows  ("G" <gerard@interfold.com>)
Responses Altering columns without losing data
List pgsql-novice
On Sun, 2002-05-05 at 10:31, G wrote:
>
> Hello,
>
> Just getting started with postgres. Is there an equivalent sql command to
> insert multiple rows? In mysql it's:
>
> insert into table (a,b,c)
> values (1,2,3), (4,5,6);
>
> I exported 6000 rows from mysql using single inserts - it's rather slow
> executing them one by one into progresql.

In PostgreSQL you should:

BEGIN WORK;
INSERT .....
...
COMMIT;

To have it all happen much quicker.

There is not equivalent syntax to the non-standard-SQL of MySQL within
the SQL standard, nor does PostgreSQL have such an extension.

If you can get the data in tab-delimited format you could also use the
COPY command in PostgreSQL to load the data much faster.

Regards,
                    Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201    MOB: +64(21)635-694    OFFICE: +64(4)499-2267
       Are you enrolled at http://schoolreunions.co.nz/ yet?


pgsql-novice by date:

Previous
From: "Joshua b. Jore"
Date:
Subject: Re: Limiting number of records to show.
Next
From: AarniRuuhimäki / Megative Tmi / KYMI.com
Date:
Subject: Re: