I have a large T-SQL stored procedure which contains 3 joins to SELECT statements which query XML values passed in as parameters.
The parameters look like this:
@Code xml = NULL
The joins look like this:
AND (@Code IS NULL OR (t.Code IN (
select Tbl.Col.value('.[1]', 'nvarchar(2)')
from @Code.nodes('//codes/code') Tbl(Col)
)))
An example of a parameter value is:
'<codes><code>GB</code></codes>'
The could be as many as 100 <code>...</code> elements within these blocks.
Every element displayed on the execution plan shows Cost: 0 % except for these joins, which show Cost: 49 %.
Is there anything I can do to improve execution time?