【发布时间】:2015-08-31 03:22:09
【问题描述】:
我想优化这个选择:
Select Dane1, Dane5, Dane6, Dane7 FROM Test
INNER JOIN Test2 ON Test.Id=Test2.IdTest
WHERE Dane5 > 199850
我的数据库有2个表test,test2:
测试设计: Id int -> 主键, Dane1 int, Dane2 整数, Dane3 int, Dane4 int, Dane5 int,
test2 设计: Id int -> 主键, Dane6 int, Dane7 int, IdTest 整数,
默认索引: PK__test__7C8480AE(Clustered)、PK__test2__7E6CC920(Clustered)
问题是: 要附加或删除哪些索引?
【问题讨论】:
-
还告诉我们聚集索引中的列。默认情况下,它们将是您的主键,但也许您没有默认值?我们无法从自动生成的集群名称中推断出任何东西:P
-
聚集索引在主键上:id 在 test 表中,id 在 test2 表中。
标签: sql-server indexing query-optimization clustered-index non-clustered-index