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

前端 未结 4 1473
轮回少年
轮回少年 2020-12-29 19:04

I have a MySQL query (running MySQL 5.0.88), which I\'m trying to speed up. The underlying table has multiple indices and for the query in question, the wrong index is used

4条回答
  •  被撕碎了的回忆
    2020-12-29 19:41

    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

提交回复
热议问题