Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1 - Mailing list pgsql-performance

From ning
Subject Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1
Date
Msg-id 27f31620907142010u391841e2ha432f939d3acbb7e@mail.gmail.com
Whole thread Raw
Responses Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1
Re: Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1
List pgsql-performance
Hi,

I am transplanting an application to use PostgreSQL8.2.4 instead of DB2 9.1.
CLI was used to connect to DB2, and ODBC is used to connect to PostgreSQL.
The query statement is as follows:

SELECT void,nameId,tag FROM (SELECT void,nameId,tag,.... FROM Attr
WHERE attributeof IN (SELECT oid_ FROM ItemView WHERE
ItemView.ItemId=?)) x RIGHT OUTER JOIN (SELECT oid_ FROM ItemView
WHERE ItemView.ItemId=? and ItemView.assignedTo_=?) y ON attributeof =
oid_ FOR READ ONLY

I tested the performance on PostgreSQL against DB2, and found that

First execution: PostgreSQL 0.006277 seconds / DB2 0.009028 seconds
Second execution: PostgreSQL 0.005932 seconds / DB2 0.000332 seconds

PostgreSQL cost nearly the same time but DB2 ran 30 times faster in
second execution.

I tried to adjust shared_buffers parameter in postgresql.conf, no speed up.
Actually my DB holds only several records so I don't think memory is the reason.

Could anybody give some advice to speed up in repeated execution in
PostgreSQL or
give an explanation why DB2 is so mush faster in repeated execution?

Thank you.
ning

pgsql-performance by date:

Previous
From: Lauris Ulmanis
Date:
Subject: CREATE USER command slows down when user count per server reaches up to 500 000
Next
From: Scott Marlowe
Date:
Subject: Re: Performance comparison between Postgres and Greenplum