Re: COPY FROM STDIN instead of INSERT

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: ilejn(at)yandex(dot)ru
Cc: pgsql-general(at)postgresql(dot)org, oleg(at)sai(dot)msu(dot)su, teodor(at)sigaev(dot)ru
Subject: Re: COPY FROM STDIN instead of INSERT
Date: 2006-10-18 13:12:49
Message-ID: b42b73150610180612t68ece0c0q7bac20d4ab5be0d6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/18/06, Ilja Golshtein <ilejn(at)yandex(dot)ru> wrote:
> I've tried to play with batches and with peculiar constructions
> like INSERT (SELECT .. UNION ALL SELECT ..) to improve performance, but not satisfied with the result I've got.

postgresql 8.2 (beta) supports the 'multiple insert' syntax, so you
can insert multiple rows in an insert statement without using 'union
all'. it's pretty fast, although not as fast as copy. btw, if you
have a lot of indexes on your table, the input method is not so
important.

aside: new insert syntax has one very nice side effect. assuming the
table(s) are already defined, I can transfer data from mysql to
postgresql via:

mysqldump --compatible=postgresql esilo | grep INSERT | psql

without any extra processing for most cases. gotta give some points
to mysql for adding postgresql compatibility which sorta works.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shane Ambler 2006-10-18 13:18:31 Re: COPY FROM STDIN instead of INSERT
Previous Message Merlin Moncure 2006-10-18 13:03:45 Re: COPY FROM STDIN instead of INSERT