Re: one transaction or multiple inserts?

Поиск
Список
Период
Сортировка
От Shridhar Daithankar
Тема Re: one transaction or multiple inserts?
Дата
Msg-id 3D9C58C8.23526.911810D@localhost
обсуждение исходный текст
Ответ на one transaction or multiple inserts?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
On 3 Oct 2002 at 18:07, Jean-Christian Imbeault wrote:

> When inserting a lot of data into a DB which would be faster, doing all
> the inserts in one transaction or doing multiple inserts?

One transaction with multiple inserts
>
> And more importantly, why? :)

Because when transaction is committed WAL is synced in some way depending upon
configuration and that costs time as it's disk activity which is much slower
compared to rest of the system..

> I'M assuming that each insert is in fact a transaction and doing, for
> example, 1000 inserts is the same as doing 1000 transaction. But if I
> put them all in one transaction, it would be equivalent to doing (duh) 1
> transaction.

Correct..

Use copy. That's simpler but it puts everythig in one transaction. You wouldn't
want to load a 100GB dump with that..

Bye
 Shridhar

--
Accuracy, n.:    The vice of being right


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

Предыдущее
От: Jean-Christian Imbeault
Дата:
Сообщение: one transaction or multiple inserts?
Следующее
От: Michelle Konzack
Дата:
Сообщение: Import textfile as table