MySQL Forums
Forum List  »  Performance

Re: multi-part index and when it is used?
Posted by: Harrison Fisk
Date: January 13, 2005 07:36AM

Hi,

"SELECT * FROM phonebook ORDER BY lastName, firstName, middleInitial" normally wouldn't use the index. The only time it would is if the * represents only the columns lastName, firstName, middleInitial (ie. there are only 3 columns in the entire table). I discussed that logic at http://forums.mysql.com/read.php?24,10738,10785#msg-10785

A covering index is when all columns in the query are part of the same index. Then MySQL won't have to read the datafile at all. Since you are retreiving all of the rows above, it won't use the index to do it unless there is a covering index.

Harrison Fisk, Trainer and Consultant
MySQL AB, www.mysql.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: multi-part index and when it is used?
2063
January 13, 2005 07:36AM


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.