"Jeff McKeon" <[EMAIL PROTECTED]> wrote on 04/06/2004 16:52:48:

> Is there a way to force the use of a specific index when issuing a
> select querie?

Yes. From the Fine Manual

"As of MySQL 3.23.12, you can give hints about which index MySQL should 
use when retrieving information from a table. By specifying USE INDEX 
(key_list), you can tell MySQL to use only one of the possible indexes to 
find rows in the table. The alternative syntax IGNORE INDEX (key_list) can 
be used to tell MySQL to not use some particular index. These hints are 
useful if EXPLAIN shows that MySQL is using the wrong index from the list 
of possible indexes. 

>From MySQL 4.0.9 on, you can also use FORCE INDEX. This acts likes USE 
INDEX (key_list) but with the addition that a table scan is assumed to be 
very expensive. In other words, a table scan will only be used if there is 
no way to use one of the given indexes to find rows in the table. 

USE KEY, IGNORE KEY, and FORCE KEY are synonyms for USE INDEX, IGNORE 
INDEX, and FORCE INDEX. 

Note: USE INDEX, IGNORE INDEX, and FORCE INDEX only affect which indexes 
are used when MySQL decides how to find rows in the table and how to do 
the join. They do not affect whether an index will be used when resolving 
an ORDER BY or GROUP BY."

        Alec


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to