Re: slow inserts

From: Ferdinand Smit <ferdinand(at)telegraafnet(dot)nl>
To: Morten Sickel <Morten(dot)Sickel(at)nrpa(dot)no>, "'Jodi Kanter'" <jkanter(at)virginia(dot)edu>, Postgres Admin List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: slow inserts
Date: 2002-03-25 10:06:15
Message-ID: 200203251006.g2PA6IV27531@server9.telegraafnet.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Niclas Gustafsson 2002-03-25 11:14:38 Re: to --enable-locale or not to --enable-locale?
Previous Message Fred Moyer 2002-03-25 09:46:00 Re: large table support 32,000,000 rows