MySQL Forums
Forum List  »  Optimizer & Parser

Re: add a correct index, the same select statement becomes 5 times slower
Posted by: shahbaz khan
Date: August 16, 2009 11:47AM

Two things.. Firstly write this query like this
SELECT * FROM down_messages WHERE msg_id>0 AND msg_type='4' AND
to_id IN ('o1803','all','f2222231','f82006573','o1803|1234','l1','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803','l1|o1803')
AND begin_time<=NOW() AND end_time>=NOW()
GROUP BY msg_id
ORDER BY msg_id

Secondly putting index on date is not good practice.
Try putting index one by one starting from msg_d.It should improve.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: add a correct index, the same select statement becomes 5 times slower
2139
August 16, 2009 11:47AM


Sorry, you can't reply to this topic. It has been closed.

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.