HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Clear missing index DMVs

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
indexmissingdmvsclear

Problem

How can I clear missing index DMVs such as dm_db_missing_index_group_stats, dm_db_missing_index_groups and dm_db_missing_index_details?

I don't have the option to restart the server or taking it offline first and put online back again as it is a production environment.

Solution

No, there is no knob for clearing just missing_index DMVs. You'll have to restart the service or, if you want to exclude specific tables, you could create a view against the DMVs with a filter.

The only DMVs you can clear manually, using DBCC SQLPERF, are sys.dm_os_wait_stats and sys.dm_os_latch_stats:

DBCC SQLPERF 
(
     [ LOGSPACE ]
     |
          [ "sys.dm_os_latch_stats" , CLEAR ]
     |
     [ "sys.dm_os_wait_stats" , CLEAR ]
) 
     [WITH NO_INFOMSGS ]

Code Snippets

DBCC SQLPERF 
(
     [ LOGSPACE ]
     |
          [ "sys.dm_os_latch_stats" , CLEAR ]
     |
     [ "sys.dm_os_wait_stats" , CLEAR ]
) 
     [WITH NO_INFOMSGS ]

Context

StackExchange Database Administrators Q#87571, answer score: 6

Revisions (0)

No revisions yet.