tigertoolbox
tigertoolbox copied to clipboard
Querying the plan cache for missing indexes vs. multiple rows per plan
Reference: https://github.com/microsoft/tigertoolbox/tree/master/Mining-PlanCache#querying-the-plan-cache-for-missing-indexes
I think this query produces inaccurate results for versions of SQL Server that can provide multiple index recommendations for a single plan, as it can combine columns from indexes needed in different tables into the one row. This also means that it won't have a row in the result set for a table mentioned in any missing index after the first one in any given plan. This situation can be seen when c1.value('(//MissingIndex/@Table)[2]', 'SYSNAME') IS NOT NULL.