标签:代码 weight english ges size -- stat cost pre
导入表结构:
select * into ProductCategory from AdventureWorksDW2014.dbo.DimProductCategory select * into Product from AdventureWorksDW2014.dbo.DimProduct
开启磁盘io:
set statistics io on select EnglishProductName,StandardCost,Color,Size,Weight from Product where size>‘M‘--0.189 io:251 set statistics io off
非聚簇索引:
创建的语句:
create nonclustered index nc_product_size on product(size)
再次执行上面的查询代码(提高了三倍):
set statistics io on select EnglishProductName,StandardCost,Color,Size,Weight from Product where size>‘M‘ --0.054 io:19 set statistics io off
建立覆盖索引:
create nonclustered index nc_product_size1 on product(size) include(EnglishProductName, StandardCost,Color,Weight)
再次执行上述语句:
set statistics io on select EnglishProductName,StandardCost,Color,Size,Weight from Product where size>‘M‘ --0.003 io:2 set statistics io off
数据库会自动选择索引:
标签:代码 weight english ges size -- stat cost pre
原文地址:http://www.cnblogs.com/sunliyuan/p/6231085.html