Lists: | pgsql-novice |
---|
From: | "G" <gerard(at)interfold(dot)com> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | insert multiple rows |
Date: | 2002-05-04 22:31:56 |
Message-ID: | ILEPLGCLIJOCNINEJCJPGEKBDJAA.gerard@interfold.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
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.
Thanks,
Gerard
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: | Raw Message | Whole Thread | Download mbox | Resend email |
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: | "G" <gerard(at)interfold(dot)com> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Altering columns without losing data |
Date: | 2002-05-09 18:11:18 |
Message-ID: | ILEPLGCLIJOCNINEJCJPMELDDJAA.gerard@interfold.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
Hello,
Is there a way to change a column's data type without removing and adding it
(and losing data)? Such as changing the text length for a column.
Thanks,
Gerard
From: | Aarni Ruuhimäki / Megative Tmi / KYMI(dot)com <aarni(dot)ruuhimaki(at)kymi(dot)com> |
---|---|
To: | "G" <gerard(at)interfold(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Altering columns without losing data |
Date: | 2002-05-10 17:55:37 |
Message-ID: | 20020510175710.TSMW29389.fep08.tmt.tele.fi@there |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
Hi !
Not sure if this is the right way, but I've done this succesfully by dumping
(pg_dump -c) the db, then drop the db, edit the dump file's CREATE TABLE
commands to change datatype or length, then restore the db with the dump.
Be careful and make sure you have the dump file somewhere safe.
BR,
aarni
On Thursday 09 May 2002 09:11 pm, you wrote:
> Hello,
>
> Is there a way to change a column's data type without removing and adding
> it (and losing data)? Such as changing the text length for a column.
>
> Thanks,
> Gerard
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)