Re: Postgresql INSERT speed (how to improve performance)?

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: Lim Berger <straightfwd007(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql INSERT speed (how to improve performance)?
Date: 2007-08-14 03:00:45
Message-ID: 46C11ADD.9020104@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Lim Berger wrote:
>
> INSERTing into MySQL takes 0.0001 seconds per insert query.
> INSERTing into PgSQL takes 0.871 seconds per (much smaller) insert query.
>
> What can I do to improve this performance? What could be going wrong
> to elicit such poor insertion performance from Postgresql?
>
> Thanks.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>

The first thing I would ask is what type of DB engine are you using
while doing the inserts on MySQL?
The reason MySQL is doing the inserts faster is it does not have
transaction support if you are using anything other than InnoDB.

With that said you can increase your insert performance by simply using
a transaction and committing every 1000 rows or so.

If you do this you will see a huge performance increase.

hope that helps.

Tony Caduto
AM Software Design
http://www.amsoftwaredesign.com
Home of Lightning Admin for PostgreSQL and MySQL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2007-08-14 03:01:21 Re: Postgresql INSERT speed (how to improve performance)?
Previous Message Ow Mun Heng 2007-08-14 02:50:33 Copy command and duplicate items (Support Replace?)