MySQL Forums
Forum List  »  Performance

How MySQL Uses Indexes
Posted by: Mola Ji
Date: May 04, 2013 08:28AM

I create a table as follows:
CREATE TABLE IF NOT EXISTS `t` (
   `id` int (11) NOT NULL AUTO_INCREMENT,
   `i` date NOT NULL,
   `o` date NOT NULL,
   PRIMARY KEY (`id`),
   Index0 KEY `` (`i`)

)
to test the performance of my query I do:
explain select * from t o Where> '2013-05-04 'and i <'2013-05-11';
I got the following output on my local computer:

| select_type | table | Type | possible_keys | key | key_len | ref | rows
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- +
| SIMPLE | t | range | a, b ​​| b | 3 | NULL | 84 | Using where |
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- +

While on a remote server, I get:

| select_type | table | Type | possible_keys | key | key_len | ref | rows
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- +
| SIMPLE | t | ALL | a, b ​​| null | 3 | NULL | 84 | Using where |
+ ---- + ------------- + ------- + ------- + -------------- - + ------ + --------- +

This means that MySQL uses the index locally, but not on the remote server. Why?

Options: ReplyQuote


Subject
Views
Written By
Posted
How MySQL Uses Indexes
2231
May 04, 2013 08:28AM
919
May 06, 2013 10:31AM
945
May 06, 2013 07:57PM
927
May 07, 2013 12:24PM
831
May 07, 2013 07:47PM
827
May 08, 2013 05:33AM
837
May 08, 2013 09:04PM


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.