MySQL Forums
Forum List  »  Optimizer & Parser

Re: Optimize Inner Join With WHERE BETWEEN dates
Posted by: Rick James
Date: June 02, 2013 01:15PM

Since TimeClass is not used on the first of a or b, please add these indexes:
INDEX(`UserID`,`ClockIn`),
INDEX(`UserID`,`ClockOut`),
One of them will be used for `a`.
Then the existing (`UserID`,`TimeClass`,`ClockIn`,...) may be used for `b`

How many different values of TimeClass are there?

Please provide the EXPLAIN after you add the above indexes; I want to see if I missed anything else.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Optimize Inner Join With WHERE BETWEEN dates
1383
June 02, 2013 01:15PM


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.