转自http://blog.csdn.net/yangzhawen/article/details/7253746
索引对查询性能影响极大,不要盲目的新建索引!数据库高开销的缺失索引 ,根据对动态性能视图的统计信息,新建需要的索引!
select c.name as 库名,c.equality_columns, c.inequality_columns,c.included_columns, c.statement as 表名, c.avg_total_user_cost as 减少的平均成本 , c.avg_user_impact as 百分比收益, c.last_user_seek as 使用后影响上次结果, c.unique_compiles from ( select a.name,b.* from ( select d.* , s.avg_total_user_cost , s.avg_user_impact , s.last_user_seek ,s.unique_compiles from sys.dm_db_missing_index_group_stats s ,sys.dm_db_missing_index_groups g ,sys.dm_db_missing_index_details d where s.group_handle = g.index_group_handle and d.index_handle = g.index_handle --order by s.avg_user_impact desc ) b, sys.databases a where a.database_id=b.database_id )c order by 百分比收益 desc,unique_compiles desc