Re: COPY versus INSERT

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: COPY versus INSERT
Дата
Msg-id 200305141655.13890.dev@archonet.com
обсуждение исходный текст
Ответ на COPY versus INSERT  ("Jay O'Connor" <joconnor@cybermesa.com>)
Ответы Re: COPY versus INSERT  ("alex b." <mailinglists1@gmx.de>)
Список pgsql-general
On Wednesday 14 May 2003 3:23 am, Jay O'Connor wrote:
> I'm loading a database with a lot of data from an external source (I'm
> convertin all my data to postgresql)
>
> Right now I'm just connecting to the database and issuing a whole lot of
> INSERTS and this is taking longer than I had planned.
>
> Would it be faster to just dump my database ina tab delimited format and
> use a COPY FROM or psql /copy command?

Almost always.

Might want to try batching your INSERTs into transactions of a few hundred-few
thousand first though - that frequently helps a lot:

BEGIN;
INSERT ...1
INSERT ...2
...
INSERT ...999
COMMIT;

--
  Richard Huxton

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: server process segfaulting
Следующее
От: Fernando Flores Prior
Дата:
Сообщение: Re: - what protocol for an Internet postgres