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
3584
June 11, 2005 12:03PM
1832
June 14, 2005 10:42AM
1958
June 14, 2005 02:16PM
1699
June 15, 2005 02:21AM
Re: Partial key
1701
June 15, 2005 05:16AM
1852
June 15, 2005 06:24AM
5054
June 15, 2005 12:06PM
1758
June 16, 2005 05:07AM
1734
June 16, 2005 07:57AM
1730
June 16, 2005 08:30AM
1785
June 16, 2005 08:50AM
1637
June 16, 2005 10:21AM
2744
June 16, 2005 03:00PM
1729
June 17, 2005 12:00AM
1651
June 17, 2005 01:28AM
1634
June 20, 2005 01:21AM
1825
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.