SQL Server 2008 R2上缺少索引缺失的统计信息

时间:2013-08-22 02:09:29

标签: sql-server-2008-r2

我安装了SQL Server 2008 R2(少数几个)并且它的系统相当繁忙。我正在尝试使用来自missing indexes tables的信息来优化我过去所做的一些索引。

似乎很奇怪的是sys.dm_db_missing_index_group_stats表是空的?!

现在我不相信该服务器上没有任何数据库错过任何一个节拍,而sys.dm_db_missing_index_group_statssys.dm_db_missing_index_group_stats等其他表包含大量记录。

刚才我看到该表中的1(一)个记录短暂出现,从那时起就消失了。

我想知道该服务器是否存在严重错误,或者我是否错过了一个微不足道的

1 个答案:

答案 0 :(得分:1)

Seems to be a bug in SQL 2008 R2. Search google for "sys.dm_db_missing_index_group_stats empty" (regards to Mike West).

I`ll try to explain what happens.

There are 4 DMOs (Dynamics Management Objects) which are used in the Missing Indexes Feature of SQL Server.
Missing index details are held in these DMOs, until purged. The purge is triggered when you actually create the missing index (or restart the server).

But, there is a limit of 600 rows that can be held within these DMOs.

This, in conjuction with the fact that the sys.dm_db_missing_index_group_stats DMO gathers data only for executed queries, wheres the other three gather data for both compiled and for executed queries introduces this "bug".

The workaround suggests that the sys.dm_db_missing_index_details dmv be queried and all suggested indexes be created with "STATISTICS_ONLY = -1" and then dropped. This would restart the index recommendations gathering.

More explanation here, and a workaround here.