I have a query:
UPDATE TOP(100000) pv
SET pv.intUrlId = urls.intUrlId
FROM [schema1].[Urls] urls WITH(NOLOCK)
INNER JOIN [schema2].[PageViews] pv WITH(NOLOCK)
ON pv.urlId = urls.id
AND pv.intUrlId IS NULL
Every column used in this query is an index and urls.id is a PRIMARY KEY. But query is still too slow. Trying to improve performance I've rebuilded pv_urlId_IDX index adding pv.intUrlId column as 'included column'. My reasoning was as follows: Query needs to search pv_urlId_IDX index to perform JOIN and next pv_intUrlId_IDX to determine NULL records. If I add value of pv.intUrlId to pv_urlId_IDX index a testing of second condition would be performed 'in place' and searching second index wouldn't be performed. Unfortunatelly I haven't noticed any performance boost.
I also read SQL Server documentation and they every time mention of nonkey column in scope of included columns. So my question is: does including key column in index make any sense and if it does when we can benefit of such solution.