DEFINITIONS

Definitions More Info.
Definition ID12.108
TitleSQL
CategoryNOTES
DefinitionMissingIndexDP
Definition Description-- Find missing index warnings for cached plans in the current database (Query 67) (Missing Index Warnings)
-- Note: This query could take some time on a busy instance
SELECT TOP(25) OBJECT_NAME(objectid) AS [ObjectName],
cp.objtype, cp.usecounts, cp.size_in_bytes, qp.query_plan
FROM sys.dm_exec_cached_plans AS cp WITH (NOLOCK)
CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle) AS qp
WHERE CAST(query_plan AS NVARCHAR(MAX)) LIKE N'%MissingIndex%'
AND dbid = DB_ID()
ORDER BY cp.usecounts DESC OPTION (RECOMPILE);
RecordBycunay
Record Date23-10-2023 11:25:45
Düzenle
Kopyala
Sil