Re: slow inserts

Поиск
Список
Период
Сортировка
От Morten Sickel
Тема Re: slow inserts
Дата
Msg-id 54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no
обсуждение исходный текст
Ответ на slow inserts  (Jodi Kanter <jkanter@virginia.edu>)
Ответы Re: slow inserts
Список pgsql-admin
Jodi Kanter wrote:

> I am currently using a Perl data loader that was set up to load data to
three particular
> tables.
(Snip)
> I have placed some debugging syntax in the code and it seems that the
extra time if
> related to postgres as I  had  originally thought it may have to do with
the parsing of
> the Excel file.

You don't mention it, but I assume you are using DBI/pg. You are sure you
are setting up you
insert qyery handlers once and then reuse them? >s setting up a query
handler takes a lot of time.

ie

my $dbh=DBI->connect(dbi:Pg ...);

my $insh = $dbh->prepare("Insert into table values (?,?,?)";

foreach ($excelrow){
 parse;
 $insh->execute($data1,$data2,$data3);
}

I have written a few script of that kind my self, and I was really surprised
how much it mattered when I managed to move a $dbi->prepare out of the
insert loop.


regards

--
Morten Sickel
Norwegian Radiation Protection Authority

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

Предыдущее
От: Auri Mason
Дата:
Сообщение: Re: unable to locate a valid checkpoint
Следующее
От: "Fred Moyer"
Дата:
Сообщение: Re: large table support 32,000,000 rows