Re: Postgres insert performance and storage requirement compared to Oracle

From: Divakar Singh <dpsmails(at)yahoo(dot)com>
To: Steve Singer <ssinger(at)ca(dot)afilias(dot)info>
Cc: jd(at)commandprompt(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Postgres insert performance and storage requirement compared to Oracle
Date: 2010-10-25 18:52:31
Message-ID: 441423.23877.qm@web65406.mail.ac4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance


Answers:

How are you using libpq?
-Are you opening and closing the database connection between each insert?

[Need to check, will come back on this]

-Are you doing all of your inserts as one big transaction or are you doing a
transaction per insert

[Answer: for C++ program, one insert per transaction in PG as well as Oracle.
But in stored proc, I think both use only 1 transaction for all inserts]

-Are you using prepared statements for your inserts?

[Need to check, will come back on this]

-Are you using the COPY command to load your data or the INSERT command?

[No]

-Are you running your libpq program on the same server as postgresql?

[Yes]

-How is your libpq program connecting to postgresql, is it using ssl?

[No]

If your run "VACUUM VERBOSE tablename" on the table, what does it say?

[Need to check, will come back on this]

You also don't mention which version of postgresql your using.

[Latest, 9.x]

Best Regards,
Divakar

________________________________
From: Steve Singer <ssinger(at)ca(dot)afilias(dot)info>
To: Divakar Singh <dpsmails(at)yahoo(dot)com>
Cc: jd(at)commandprompt(dot)com; pgsql-performance(at)postgresql(dot)org
Sent: Tue, October 26, 2010 12:16:46 AM
Subject: Re: [PERFORM] Postgres insert performance and storage requirement
compared to Oracle

On 10-10-25 02:31 PM, Divakar Singh wrote:
>
> > My questions/scenarios are:
> >
> > 1. How does PostgreSQL perform when inserting data into an indexed
> > (type: btree)
> > table? Is it true that as you add the indexes on a table, the
> > performance
> > deteriorates significantly whereas Oracle does not show that much
> > performance
> > decrease. I have tried almost all postgreSQL performance tips
> > available. I want
> > to have very good "insert" performance (with indexes), "select"
> > performance is
> > not that important at this point of time.
>
> -- Did you test?
>
> Yes. the performance was comparable when using SQL procedure. However,
> When I used libpq, PostgreSQL performed very bad. There was some
> difference in environment also between these 2 tests, but I am assuming
> libpq vs SQL was the real cause. Or it was something else?

So your saying that when you load the data with psql it loads fine, but
when you load it using libpq it takes much longer?

How are you using libpq?
-Are you opening and closing the database connection between each insert?
-Are you doing all of your inserts as one big transaction or are you
doing a transaction per insert
-Are you using prepared statements for your inserts?
-Are you using the COPY command to load your data or the INSERT command?
-Are you running your libpq program on the same server as postgresql?
-How is your libpq program connecting to postgresql, is it using ssl?

>
> Some 10-12 columns ( like 2 timestamp, 4 int and 4 varchar), with 5
> indexes on varchar and int fields including 1 implicit index coz of PK.

If your run "VACUUM VERBOSE tablename" on the table, what does it say?

You also don't mention which version of postgresql your using.

>
>
> Joshua D. Drake
>
>
> --
> PostgreSQL.org Major Contributor
> Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
> Consulting, Training, Support, Custom Development, Engineering
> http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mladen Gogala 2010-10-25 18:56:13 Re: Postgres insert performance and storage requirement compared to Oracle
Previous Message Jeff Davis 2010-10-25 18:51:49 Re: Floating-point timestamps versus Range Types

Browse pgsql-performance by date

  From Date Subject
Next Message Mladen Gogala 2010-10-25 18:56:13 Re: Postgres insert performance and storage requirement compared to Oracle
Previous Message Merlin Moncure 2010-10-25 18:50:42 Re: AIX slow buffer reads