Re: copy vs. insert w/ no autocommit

Поиск
Список
Период
Сортировка
От Francisco Reyes
Тема Re: copy vs. insert w/ no autocommit
Дата
Msg-id 20011219193418.R5735-100000@zoraida.natserv.net
обсуждение исходный текст
Ответ на copy vs. insert w/ no autocommit  (Matthew Kennedy <mkennedy@opushealthcare.com>)
Список pgsql-general
On 18 Dec 2001, Matthew Kennedy wrote:

> I realize a COPY statement is much faster than individual INSERT
> statements.

How? Have you tested it? Or do you mean that from reading people's
comments you believe this to be "common knowledge".

>But how does COPY compare to individual INSERTS within a
>BEGIN/END or with setAutoCommit(false)?

Are we talking "copy" or "\copy"?

I am not sure about \copy, but "copy" as far as I know doesn't update all
the stats/indexes so it should be significantly faster to use a copy.

So far for all my big jobs (anything greater than a few thousand rows) I
always use copy and it is fairly fast.

Have you tried doing some testing? How many indexes do you have on the
table?

> If there's a difference, are we
> talking orders-of-magnitude in difference?

Depending on your disk subsistem I would expect copy should be several
times faster due to index overhead.


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

Предыдущее
От: marc@oscar.eng.cv.net (Marc Spitzer)
Дата:
Сообщение: Re: Migrate Store Procedure Sybase to PostgreSQL
Следующее
От: Matt Sauve-Frankel
Дата:
Сообщение: Re: More on Too Many Open Files... NetBSD