查询从未使用的索引

SELECT object_name(object_id)
	,* sys.dm_db_index_usage_state
WHERE user_seeks = 0
	AND user_scans = 0
	AND user_lookups = 0
	AND system_seeks = 0
	AND system_scans = 0
	AND system_lookups = 0
	AND object_name(object_id) IS NOT NULL

编程技巧