How to hint the index to use in a MySQL select query?

sometimes, with use index (index_name) optimizer might go for table scan, if you use hint force index, optimizer will be forced to use index, will go for table scan only if no ways left to get the rows with provided index.

SELECT art.firma FROM art FORCE INDEX (i_iln);

for more detail on hints USE INDEX and FORCE INDEX check this link


You missed the

FROM table

Correct SQL should be:

SELECT art.firma FROM your_table USE INDEX (i_iln) WHERE ....

select * from table use index (idx);

http://dev.mysql.com/doc/refman/5.0/en/index-hints.html