In SQL Server 2000 - how can we find unused indexes, so that we can drop them.]
I have scripts for 2008 but don't know how to do it in SQL Server 2000.
Please help.
Regards
In SQL Server 2000 - how can we find unused indexes, so that we can drop them.]
I have scripts for 2008 but don't know how to do it in SQL Server 2000.
Please help.
Regards
The only thing I can recommend is to put your 2000 database on a server with SQL Server 2005 or greater (a development or test server) installed, find the unused indexes with the help of the new DMVs and once you have a list of changes apply them back to the production SQL Server 2000 instance.
Please be aware that SQL Server 2000 is no longer supported and you should move your production processes, if possible, to a later version of SQL Server.
An example query in SQL Server 2012 using the sys.dm_db_index_usage_stats DMV:
SELECT u.*
FROM [sys].[indexes] i
JOIN [sys].[objects] o
ON (i.OBJECT_ID = o.OBJECT_ID)
LEFT JOIN [sys].[dm_db_index_usage_stats] u
ON (i.OBJECT_ID = u.OBJECT_ID)
AND i.[index_id] = u.[index_id]
AND u.[database_id] = DB_ID() --returning the database ID of the current database
WHERE o.[type] <> 'S' --shouldn't be a system base table
AND i.[type_desc] <> 'HEAP'
AND i.[name] NOT LIKE 'PK_%'
AND u.[user_seeks] + u.[user_scans] + u.[user_lookups] = 0
AND u.[last_system_scan] IS NOT NULL
ORDER BY 1 ASC
Unused Index information is not exposed in sql 2000 as SQL 2000 and lower versions did not have DMV's.
The only possible way (in sql 2000) is to use a server side trace to see what tables and indexes are used by your queries for the entire business cycle or workload period.
You should plan for an upgrade to higher versions like 2008R2 or 2012 as SQL Server 2000 is now officially unsupported.