MySQL Forums
Forum List  »  MyISAM

Re: MYISAM INDEX KEY Question
Posted by: Rick James
Date: May 28, 2014 12:48AM

> May I know the reasons that the query does not get 'index_key1' as indexing purpose?

There are many possible reasons. However your two SELECTs are identical.

Another tip... Don't use "SELECT *" if you don't need _all_ the columns. One thing the optimizer will do is pick an index based on what columns it will need. "*" includes `description`, which is not in any INDEX. This limits what optimizations it can do. To see what I mean, try these:

EXPLAIN SELECT client_id, user_id
FROM `users`
WHERE `client_id` LIKE 'nanako' AND `user_id` LIKE ‘jasmine' ;

EXPLAIN SELECT client_id, user_id, password
FROM `users`
WHERE `client_id` LIKE 'nanako' AND `user_id` LIKE ‘jasmine' ;

EXPLAIN SELECT client_id, user_id, description
FROM `users`
WHERE `client_id` LIKE 'nanako' AND `user_id` LIKE ‘jasmine' ;

Options: ReplyQuote


Subject
Views
Written By
Posted
3724
May 27, 2014 02:49AM
Re: MYISAM INDEX KEY Question
1820
May 28, 2014 12:48AM
1719
May 29, 2014 01:57AM
1778
May 29, 2014 10:44PM


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.