8 messages in com.mysql.lists.clusterRe: query performance slow
FromSent OnAttachments
Bob Pisani25 Jul 2007 08:43 
Anatoly Pidruchny25 Jul 2007 08:59 
Bob Pisani25 Jul 2007 09:01 
Bob Pisani25 Jul 2007 09:02 
Brian Moon25 Jul 2007 15:11 
Bob Pisani26 Jul 2007 06:08 
Bob Pisani26 Jul 2007 07:22 
Brian Moon26 Jul 2007 07:43 
Subject:Re: query performance slow
From:Brian Moon (bri@dealnews.com)
Date:07/26/2007 07:43:43 AM
List:com.mysql.lists.cluster

Bob Pisani wrote:

PRIMARY KEY(ORDER_TIME, ORDER_ID)

Bob Pisani wrote:

-- Indexes -- PRIMARY KEY(ORDER_ID, ORDER_TIME) - UniqueHashIndex PRIMARY(ORDER_TIME, ORDER_ID) - OrderedIndex

So the hash index is going to work fast. But its the ordered index that would be used for a range query. I would try reversing this key to be:

PRIMARY KEY(ORDER_ID, ORDER_TIME)

and see if it gets better. Hopefully that will make the OrderedIndex in the proper order. Even in MyISAM and InnoDB you would want that order anyway for their BTree indexes. Basically, values that will queried based on range need to go as far to the right in the index as possible.

------------------------------ http://dealnews.com/ It's good to be cheap =)