Re: slow inserts - Mailing list pgsql-admin

From Ferdinand Smit
Subject Re: slow inserts
Date
Msg-id 200203251006.g2PA6IV27531@server9.telegraafnet.nl
Whole thread Raw
In response to Re: slow inserts  (Morten Sickel <Morten.Sickel@nrpa.no>)
List pgsql-admin
<ZIP>

> my $dbh=DBI->connect(dbi:Pg ...);
>
> my $insh = $dbh->prepare("Insert into table values (?,?,?)";
>

$insh->begin_work;

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

$insh->commit;

>
> 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.

Try to use transactions, that increates the speed too.

Regards,
Ferdinand

pgsql-admin by date:

Previous
From: "Fred Moyer"
Date:
Subject: Re: large table support 32,000,000 rows
Next
From: "Niclas Gustafsson"
Date:
Subject: Re: to --enable-locale or not to --enable-locale?