Re: PostgreSQL Write Performance

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Yan Cheng Cheok" <yccheok(at)yahoo(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL Write Performance
Date: 2010-01-06 07:05:36
Message-ID: D425483C2C5C9F49B5B7A41F89441547029626CC@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: Yan Cheng Cheok [mailto:yccheok(at)yahoo(dot)com]
> Sent: Tuesday, January 05, 2010 10:30 PM
> To: Craig Ringer
> Cc: Dann Corbit; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] PostgreSQL Write Performance
>
> Thanks for the information. I perform benchmarking on a very simple
> table, on local database. (1 table, 2 fields with 1 is bigserial,
> another is text)
>
> ====================================================================
> INSERT INTO measurement_type(measurement_type_name) VALUES ('Hello')
> ====================================================================
>
> I turn synchronous_commit to off.
>
> To write a single row(local database), the time taken is in between
> 0.1ms and 0.5ms
>
> I try to compare this with flat text file.
>
> To write a single row(file), the time taken is in between 0.005ms and
> 0.05ms
>
> The different is big. Is this the expected result? Are you guys also
> getting the similar result?

Ten to one is not surprising. You will save quite a bit by doing a
prepare and a large number of inserts in a single transaction.

> I know there shall be some overhead to write to database compared to
> flat text file. (network communication, interpretation of SQL
> statement...) However, Is there any way to further improve so that
> PostgreSQL write performance is near to file?
>
> If not, I need to plan another strategy, to migrate my flat text file
> system, into PostgreSQL system smoothly.

Did you try the copy command? It will be very much faster.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hx.li 2010-01-06 07:48:58 FULL JOIN is only supported with merge-joinable join conditions
Previous Message Stephen Cook 2010-01-06 06:50:01 Re: PostgreSQL Write Performance