Skip site navigation (1) Skip section navigation (2)

Re: 200 times slower then MSSQL??

From: Kaloyan Iliev Iliev <news1(at)faith(dot)digsys(dot)bg>
To: Alexander Dolgin <alex(at)dolgin(dot)dp(dot)ua>,pgsql-performance(at)postgresql(dot)org
Subject: Re: 200 times slower then MSSQL??
Date: 2005-01-25 18:09:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
First it will be good if you supply some EXPLAIN ANALYZE results from 
your query.
Second, do you created the indexes which can be used with WHERE conditions.
And Third AFAK MAX doesn't use index. If you only need max then you can try:

ORDER BY .... DESC  and  LIMIT 1. But you can't use this if you want to 
select the two max values at once.
I am not an expert so if I am wrong, please someone to correct me.


Alexander Dolgin wrote:

>Hi all,
>We are developing some application that works with DB over JDBC. We've used
>MSSQL before and trying to migrate to PostgreSQL now. Unfortunately problems
>with performance are found. MSSQL with default configuration looks like much
>faster then PostgreSQL on the same hardware (PostgreSQL8 rc5 was used). I've
>tried to increase work_mem significant (work_mem = 262144) but it doesn't
>Here is result of simple benchmark. I have table 
>CREATE TABLE elt_tcli_messagelog
>  connectionname varchar(64),
>  msgseqnum int4,
>  connectionmessageid int4,
>  logtimestamp varchar(64),
>  isfromcounterparty char(1),
>  msgtype varchar(64),
>  possdupflag char(1),
>  isoutofsequence char(1),
>  ordtrnid varchar(64),
>  ordrqstid varchar(64),
>  counterrequestid varchar(64),
>  clordid varchar(64),
>  origclordid varchar(64),
>  execid varchar(64),
>  exectranstype varchar(64),
>  exectype varchar(64),
>  ordstatus varchar(64),
>  lastqty float8,
>  orderqty float8,
>  cumqty float8,
>  leavesqty float8,
>  sendercompid varchar(64),
>  targetcompid varchar(64),
>  tradeaccthrchy varchar(64),
>  tradeacctid varchar(64),
>  routedtransactiondestination varchar(64),
>  originatingconnectionname varchar(64),
>  originatingconnectionmsgid int4,
>  instrument varchar(64),
>  portfolio varchar(64),
>  prevseqnum int4,
>  "Message" text,
>  nonmetadatafields text
>with about 8000 rows. For this table query:
>SELECT MAX(MsgSeqNum),MAX(LogTimestamp) FROM ELT_tcli_MessageLog 
>WHERE LogTimestamp  >=  '0' AND IsFromCounterParty  =  'Y' AND
>IsOutOfSequence = 'N' 
>     AND ConnectionName  =  'DB_BENCHMARK' 
>     AND LogTimestamp IN (SELECT MAX(LogTimestamp) 
>                          FROM ELT_tcli_MessageLog 
>                          WHERE MsgSeqNum  >  0 AND IsFromCounterParty = 'Y'
>                                AND IsOutOfSequence  =  'N' AND
>ConnectionName  =  'DB_BENCHMARK')
>takes about 1 second on MSSQL Server and 257 seconds on PostgreSQL one.
>Does anybody have idea about reasons of such results?
>Alexander Dolgin.
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

pgsql-performance by date

Next:From: Mitch PirtleDate: 2005-01-25 18:19:48
Subject: PG versus FreeBSD, startup and connections problems
Previous:From: Tom LaneDate: 2005-01-25 18:02:23
Subject: Re: 200 times slower then MSSQL??

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group