Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find a disabled index on SQL server 2008

A while back when I was performing some bulk inserts of data into my SQL Server database, I disabled a number of indexes to improve the insert performance. I now need to go back and rebuild/re-enable them.

Unfortunately, I'm not sure exactly which indexes I disabled.

Is there a way I can query to identify which indexes are disabled and should be re-enabled?

like image 218
star Avatar asked Aug 16 '10 17:08

star


People also ask

How do I enable a disabled index in SQL Server?

Click the plus sign to expand the table on which you want to enable an index. Click the plus sign to expand the Indexes folder. Right-click the index you want to enable and select Rebuild. In the Rebuild Indexes dialog box, verify that the correct index is in the Indexes to rebuild grid and click OK.

How do I find missing index in SQL?

To determine which missing index groups a particular missing index is part of, you can query the sys. dm_db_missing_index_groups dynamic management view by equijoining it with sys. dm_db_missing_index_details based on the index_handle column. The result set for this DMV is limited to 600 rows.

What happens when you disable an index?

Disabling an index prevents user access to the index, and for clustered indexes to the underlying table data. The index definition remains in metadata, and index statistics are kept on nonclustered indexes. Disabling a clustered index on a view or a nonclustered index physically deletes the index data.


1 Answers

select     sys.objects.name as table_name,     sys.indexes.name as index_name from sys.indexes     inner join sys.objects on sys.objects.object_id = sys.indexes.object_id where sys.indexes.is_disabled = 1 order by     sys.objects.name,     sys.indexes.name 
like image 180
Daniel Renshaw Avatar answered Oct 02 '22 16:10

Daniel Renshaw