From: Ferdinand Smit <ferdinand@telegraafnet.nl>
To: Morten Sickel <Morten.Sickel@nrpa.no>
To: 'Jodi Kanter' <jkanter@virginia.edu>
To: Postgres Admin List <pgsql-admin@postgresql.org>
Subject: Re: slow inserts
Date: Mon, 25 Mar 2002 11:06:15 +0100
Message-ID: <200203251006.g2PA6IV27531@server9.telegraafnet.nl> (raw)
In-Reply-To: <54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no>
References: <54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no>
<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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: ferdinand@telegraafnet.nl, Morten.Sickel@nrpa.no, jkanter@virginia.edu
Subject: Re: slow inserts
In-Reply-To: <200203251006.g2PA6IV27531@server9.telegraafnet.nl>
References: <54DE9A561AD20C4D9FF88B116965420E029F9C@postix.nrpa.no> <200203251006.g2PA6IV27531@server9.telegraafnet.nl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox