包含SQL索引提示如何影响查询性能? [英] How does including a SQL index hint affect query performance?

查看:102
本文介绍了包含SQL索引提示如何影响查询性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在SQL 2005数据库中有一个包含2,000,000条记录和一些索引的表。在我的查询中使用索引提示有什么好处?在查询中使用索引提示是否有缺点?

Say I have a table in a SQL 2005 database with 2,000,000+ records and a few indexes. What advantage is there to using index hints in my queries? Are there ever disadvantages to using index hints in queries?

推荐答案

我相信每个人都指向的关键点是非常仔细地考虑索引提示的使用可以提高查询的性能,如果仅存在,可以使用多个索引来检索数据,以及SQL Server是否使用了正确的索引。

The key point that I believe everyone here is pointing to is that with VERY careful consideration the usage of index hints can improve the performance of your queries, IF AND ONLY IF, multiple indexes exist that could be used to retreive the data, AND if SQL Server is not using the correct one.

根据我的经验,我发现需要索引提示并不常见,我相信我可能有2-3个使用它们的查询已经使用过它们....正确的索引创建和数据库优化应该可以帮助您完成执行数据库的大部分工作。

In my experience I have found that it is NOT very common to need Index hints, I believe I maybe have 2-3 queries that are in use today that have used them.... Proper index creation and database optimization should get you most of the way there to the performing database.

这篇关于包含SQL索引提示如何影响查询性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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