MySQL Forums
Forum List  »  Performance

Re: Partial key
Posted by: noudshoorn
Date: June 15, 2005 05:16AM

I explain it to you:

the key is a multiple index on name, departuredate and departuretime.
the name of the key is name (this doesn't seem the problem).
the tablename is A.
the table has now 12 rows.
10 rows with name starting with an N:
Noordman
Noorman
Noorman
Naarman
Noordman
Noordman
Noorman
Naarman
Noorman
Noordman.

Explain select * form A where name like 'N'%' says that the possible key is name, but it doesn't use the index. In the execution of the select the rows are showed in the range they were inserted.

But when I execute the select * from A where name like 'Noordm%' then the selected rows are displayed conform the index. You can see that because date and time are also in the correct range.

I did several tests and I see that the index only is used when the complete names selected by LIKE are the same and the number of selected rows is <= the total numer of rows.

What I want is that in all cases the index is used.

Any ideas,

Nico Oudshoorn

Options: ReplyQuote


Subject
Views
Written By
Posted
3566
June 11, 2005 12:03PM
1823
June 14, 2005 10:42AM
1953
June 14, 2005 02:16PM
1691
June 15, 2005 02:21AM
Re: Partial key
1692
June 15, 2005 05:16AM
1844
June 15, 2005 06:24AM
5046
June 15, 2005 12:06PM
1752
June 16, 2005 05:07AM
1720
June 16, 2005 07:57AM
1723
June 16, 2005 08:30AM
1780
June 16, 2005 08:50AM
1627
June 16, 2005 10:21AM
2731
June 16, 2005 03:00PM
1725
June 17, 2005 12:00AM
1640
June 17, 2005 01:28AM
1628
June 20, 2005 01:21AM
1819
June 20, 2005 06:41AM


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.