How to use index in select statement?

前端 未结 8 631
误落风尘
误落风尘 2020-12-12 12:42

Lets say in the employee table, I have created an index(idx_name) on the emp_name column of the table.

Do I need to explicitly specify the index name in

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 13:13

    Good question,

    Usually the DB engine should automatically select the index to use based on query execution plans it builds. However, there are some pretty rare cases when you want to force the DB to use a specific index.

    To be able to answer your specific question you have to specify the DB you are using.

    For MySQL, you want to read the Index Hint Syntax documentation on how to do this

提交回复
热议问题