我对SQL Server优化和索引的世界比较陌生。我运行了一个查询,建议缺少索引(https://blog.sqlauthority.com/2011/01/03/sql-server-2008-missing-index-script-download/),并且我无法理解Include
子句的差异。SQL Server非集群索引 - 包含值
我的两个索引唯一的区别是Index1
包含'电子邮件'列和Index2
不。这两个指标是必需的还是会足够的?我相信只有Index1是必要的,但我不确定。
CREATE INDEX [Index1]
ON [ActiveDirectory].[dbo].[ActiveDirectory] ([MailEnabled], [Active])
INCLUDE ([EmployeeID], [DisplayName], [Email])
CREATE INDEX [Index2]
ON [ActiveDirectory].[dbo].[ActiveDirectory] ([MailEnabled], [Active])
INCLUDE ([EmployeeID], [DisplayName])
谢谢!
Griz
什么类型,并在值范围MailEnabled和Active? –