punkish has asked for the wisdom of the Perl Monks concerning the following question:
my $sth = $dbh->prepare("INSERT INTO table (a, b, c) VALUES (?, ?, ?)" +); for my $row (@table) { $sth->execute($row->[0], $row->[1], $row->[2]); } $dbh->commit;
I'd like to speed up the INSERTs by possibly using the COPY table FROM STDIN WITH DELIMITER AS ',' command. Is there a way I can do that? Is there some other way I can speed up the INSERTs?
Update: I should have added, right now the INSERTs are rather slow; several seconds for every 100K INSERTs.
Update2: I finally got a result back from one set of INSERTs. I am getting ~3300 insertions per second. I would consider that fairly slow.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Speeding up Postgres INSERTs
by jau (Hermit) on Jun 18, 2010 at 07:25 UTC | |
|
Re: Speeding up Postgres INSERTs
by happy.barney (Friar) on Jun 18, 2010 at 10:51 UTC | |
by punkish (Priest) on Jun 18, 2010 at 11:41 UTC | |
by punkish (Priest) on Jun 19, 2010 at 01:11 UTC | |
|
Re: Speeding up Postgres INSERTs
by Khen1950fx (Canon) on Jun 18, 2010 at 06:13 UTC | |
|
Re: Speeding up Postgres INSERTs
by JavaFan (Canon) on Jun 18, 2010 at 09:02 UTC | |
by punkish (Priest) on Jun 18, 2010 at 14:10 UTC | |
by JavaFan (Canon) on Jun 18, 2010 at 14:59 UTC | |
by punkish (Priest) on Jun 18, 2010 at 15:18 UTC | |
by JavaFan (Canon) on Jun 18, 2010 at 16:58 UTC | |
|
Re: Speeding up Postgres INSERTs
by Krambambuli (Curate) on Jun 18, 2010 at 06:49 UTC |