| From: | Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz> |
|---|---|
| To: | G <gerard(at)interfold(dot)com> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: insert multiple rows |
| Date: | 2002-05-05 00:07:14 |
| Message-ID: | 1020557234.15995.5.camel@kant.mcmillan.net.nz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joshua b. Jore | 2002-05-05 00:20:54 | Re: Limiting number of records to show. |
| Previous Message | G | 2002-05-04 22:31:56 | insert multiple rows |