SQL提示
SQL提示,是优化数据库的一个重要过程,简单来说,就是在SQL语句中加入一些人为的提示来达到优化操作的目的
use index
建议mysql使用哪一个索引来完成此次查询(仅仅只是建议,mysql内部还是会在此进行评估)
select * from table_name use index(index_name) where id = 1 ;
ignore index
忽略指定索引
select * from table_name ignore index(index_name) where id = 1 ;
force index
强制使用索引
select * from table_name force index(index_name) where id = 1;