具有多个索引名称的相同列。有可能的。有什么用? [英] Same column with multiple index names. It is possible. What is the use?

查看:277
本文介绍了具有多个索引名称的相同列。有可能的。有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对我来说,没有必要/打算为同一列创建多个索引名称。当我正在研究索引时,我尝试了以下测试。有什么用?有什么功能吗?

For me there is no need/intention to create multiple index names for a same column. When i'm studying about index i tried the following test. What is the use of the same? Is there any feature?

我试过的是:


create index id on TestIndex(EmployeeMumber)
create index id1 on TestIndex(EmployeeMumber)
create index id2 on TestIndex(EmployeeMumber)

结果是:命令已成功完成。

The result is: Command(s) completed successfully.

谢谢

推荐答案

SQL Server不会阻止您创建重复索引(尽管没有成功的推动来改变这种情况)。 不会修复可能主要是出于向后兼容性的原因 - 在以前的版本中可能会出现一些用例,人们会在删除旧索引之前创建一个新索引,当像 DROP_EXISTING 或在线重建不存在。随着引擎中的新功能的发展,例如 INCLUDE 列,过滤索引等,确定两个索引是否实际上是重复的也更复杂。

SQL Server doesn't prevent you from creating duplicate indexes (though there has been an unsuccessful push to change this). The "won't fix" is probably largely for backward compatibility reasons - there were probably use cases in previous versions where people would create a new index before dropping an old one, back when options like DROP_EXISTING or rebuilding online didn't exist. As new features in the engine evolve, such as INCLUDE columns, filtered indexes, etc. it is also more complex to determine whether or not two indexes are, in fact, duplicates.

这篇关于具有多个索引名称的相同列。有可能的。有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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