Repeated Query is much slower in PostgreSQL8.2.4 than DB2 9.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux