如何在select语句中使用索引? [英] How to use index in select statement?

查看:529
本文介绍了如何在select语句中使用索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设在employee表中,我已在表的 emp_name 列上创建了一个索引(idx_name)。

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

我需要在select子句中显式指定索引名,否则它将自动用于加速查询。

Do I need to explicitly specify the index name in select clause or it will automatically used to speed up queries.

如果需要在select子句,在select查询中使用索引的语法是什么?

If it is required to be specified in the select clause, What is the syntax for using index in select query ?

推荐答案

如果你想测试索引,工作,这里是语法:

If you want to test the index to see if it works, here is the syntax:

SELECT *
FROM Table WITH(INDEX(Index_Name))

WITH语句将强制使用索引。

The WITH statement will force the index to be used.

这篇关于如何在select语句中使用索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆