Re: postgresql multiple insert slow

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: postgresql multiple insert slow
Дата
Msg-id m3ad3cpj8m.fsf@wolfe.cbbrowne.com
обсуждение исходный текст
Ответ на postgresql multiple insert slow  ("Michael L. Hostbaek" <mich@freebsdcluster.org>)
Список pgsql-sql
Centuries ago, Nostradamus foresaw when mich@freebsdcluster.org ("Michael L. Hostbaek") would write:
> I runs fine - and I get no errors - but it takes almost 25 minutes to
> complete.. I tried running the script while just grabbing the rows from
> the oracle database and writing to a text file - and then it only takes
> a couple of minutes .. So it must be the INSERT command that chokes - is
> there a better way to do it ? 
>
> Any advise much appreciated.

The problem here is that each insert implicitly sets up a transaction
BEGIN and COMMIT.

If you were to wrap the loop with a BEGIN at the start and a COMMIT at
the end, you would likely find it would complete much, much faster.
-- 
output = ("cbbrowne" "@" "acm.org")
http://www3.sympatico.ca/cbbrowne/wp.html
"Java and C++ make you think that the new ideas are like the old ones.
Java is the most distressing thing to hit computing since MS-DOS."
-- Alan Kay


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Function
Следующее
От: elein
Дата:
Сообщение: Re: searching polygons