Skip site navigation (1) Skip section navigation (2)

Re: Insert performance, what should I expect?

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Brock Henry <brock(dot)henry(at)gmail(dot)com>
Cc: Postgresql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Insert performance, what should I expect?
Date: 2004-10-20 02:12:28
Message-ID: 1098238348.747.20.camel@home (view raw or flat)
Thread:
Lists: pgsql-performance
> I've done some manual benchmarking running my script 'time script.pl'
> I realise my script uses some of the time, bench marking shows that
> %50 of the time is spent in dbd:execute.

The perl drivers don't currently use database level prepared statements
which would give a small boost.

But your best bet is to switch to using COPY instead of INSERT. Two ways
to do this.

1) Drop DBD::Pg and switch to the Pg driver for Perl instead (non-DBI
compliant) which has functions similar to putline() that allow COPY to
be used.

2) Have your perl script output a .sql file with the data prepared (COPY
statements) which you feed into the database via psql.

You can probably achieve a 50% increase in throughput.


In response to

Responses

pgsql-performance by date

Next:From: Josh CloseDate: 2004-10-20 04:02:30
Subject: Re: how much mem to give postgres?
Previous:From: Matthew T. O'ConnorDate: 2004-10-20 02:12:10
Subject: Re: Insert performance, what should I expect?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group