MySQL Forums :: Performance :: How MySQL Uses Indexes


Advanced Search

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 1318 Mola Ji 05/04/2013 08:28AM
Re: How MySQL Uses Indexes 569 Øystein Grøvlen 05/06/2013 03:46AM
Re: How MySQL Uses Indexes 598 Mola Ji 05/06/2013 10:31AM
Re: How MySQL Uses Indexes 598 Rick James 05/06/2013 07:57PM
Re: How MySQL Uses Indexes 590 Mola Ji 05/07/2013 12:24PM
Re: How MySQL Uses Indexes 614 Rick James 05/07/2013 07:47PM
Re: How MySQL Uses Indexes 538 Mola Ji 05/08/2013 05:33AM
Re: How MySQL Uses Indexes 513 Rick James 05/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.