首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

用showplan all查看使用索引成本,疑问,救,该怎么解决

2012-04-06 
用showplan all查看使用索引成本,疑问,急救我用showplan all 查看 表在建立索引前,和建立索引后的搜索快慢

用showplan all查看使用索引成本,疑问,急救
我用showplan all 查看 表在建立索引前,和建立索引后的搜索快慢和系统消耗

下面是结果

建立前

stmttext estimate_row estimate_io estimate_cup avg_row_size total_subtreecost

select... 1 null null null 0.003289
clustered index scan... 1 0.00312 0.00016 500 0.003289

建立后

stmttext estimate_row estimate_io estimate_cup avg_row_size total_subtreecost
select... 1 null null null 0.00657
nested loop... 1 0 4.18e-6 500 0.00657
index seek... 1 0.0031 0.00016 28 0.003283
clustered index seek... 1 0.0031 0.00016 479 0.003283

是不是建立索引后总的用时为0.00657,比不建立索引用时0.003289还要久?

[解决办法]
索引是把双刃剑,能提高查询速度,但是牺牲硬盘空间.

不过总的原则上来说,建立索引比不建立索引好.

[解决办法]
你表才1行数据,搞啥啊.

热点排行