MySQL Forums
Forum List  »  Optimizer & Parser

Re: query executes slowly in a table with 2m records
Posted by: Rick James
Date: July 14, 2010 11:12PM

Please do
You will probably find it hitting all 12*16 partitions. If so, this is because of the expression WHERE MONTH(quoteDate) = 6 .

Can you turn it into
WHERE quoteDate >= '2010/06/01'
AND quoteDate < DATE_ADD('2010/06/01', INTERVAL 1 MONTH)
? If so, do the EXPLAIN and see if it drops to only 16 partitions.

I suspect PARTITION handler is smart enough to deal with
but the optimizer is not smart enough for
WHERE MONTH(quoteDate) = 6

Can we see some more of the SELECTs that hit this table. I suspect there is a "better" way to partition it.

Options: ReplyQuote

Written By
Re: query executes slowly in a table with 2m records
July 14, 2010 11:12PM

Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.