Question on non clustered index with included columns (DB – MS SQL Server).
I read blog Optimized Non-clustered Index Maintenance which gives information on query plans when update statements is executed and clustered index and non clustered index are defined for table.
I have question on non clustered index with included columns.
I'm referring same example provided by blogger
CREATE TABLE T (PK INT, A INT, B INT, C INT, D INT, E INT)
CREATE UNIQUE CLUSTERED INDEX TPK ON T(PK)
CREATE INDEX TB ON T(B)
CREATE INDEX TCD ON T(C,D)
CREATE INDEX TE ON T(E)
— this is new non clustered index with included columns
CREATE INDEX TF ON T(E) INCLUDE(A)
INSERT T VALUES(0, 10, 20, 30, 40, 50)
UPDATE T SET A = 19
If no index TF is defined then only update on clustered index will be performed and nonclustered index insert and delete operations will not be performed.
But what will happen when TF is defined?
Best Answer
The blog post you reference also indicates how you could have answered this yourself.
If you execute
The plan looks like
showing a per-row / narrow plan where the index
TF
is listed as one of the objects updated.