Optimized Non-clustered Index Maintenance in Per-Index Plans

Published Mar 23 2019 05:07 AM 188 Views
Microsoft
First published on MSDN on Aug 22, 2007

In my last post , I showed how SQL Server 2005 only updates non-clustered indexes when the data in the index actually changes.  For my example, I used a simple update statement that results in a per-row or narrow plan.  In this post, I'll show how this optimization works in a per-index or wide update plan.


Let's use the same schema and update statement from last week.  To get a per-index plan, we can trick the optimizer into believing that the table is much larger than it really is by running some UPDATE STATISTICS statements with the ROWCOUNT and PAGECOUNT options.  (We could, of course, make the table larger by actually inserting more rows, but the UPDATE STATISTICS route is faster.)


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)


INSERT T VALUES(0, 10, 20, 30, 40, 50)


UPDATE STATISTICS T WITH ROWCOUNT = 100000, PAGECOUNT = 10000
UPDATE STATISTICS T (TB) WITH ROWCOUNT = 100000, PAGECOUNT = 1000
UPDATE STATISTICS T (TCD) WITH ROWCOUNT = 100000, PAGECOUNT = 1000
UPDATE STATISTICS T (TE) WITH ROWCOUNT = 100000, PAGECOUNT = 1000


SET STATISTICS PROFILE ON


UPDATE T SET B = 29, C = 39, D = 49


By running this statement with SET STATISTICS PROFILE ON, we can see the exact number of rows processed by each index update operator:


Rows   Executes
2      1        |--Sequence
2 1             |--Index Update(OBJECT:([T].[TB]), SET:([PK1036] = [T].[PK],[B1037] = [T].[B]) WITH ORDERED PREFETCH)
2 1             |    |--Sort(ORDER BY:([T].[B] ASC, [T].[PK] ASC, [Act1035] ASC))
2 1             |         |--Filter(WHERE:(NOT [Expr1031]))
2      1             |              |--Table Spool
2      1             |                   |--Split
1      1             |                        |--Clustered Index Update(OBJECT:([T].[TPK]), SET:([T].[B] = [Expr1025],[T].[C] = [Expr1026],[T].[D] = [Expr1027]))
1      1             |                             |--Compute Scalar(DEFINE:([Expr1031]=[Expr1031], [Expr1032]=[Expr1032]))
0      0             |                                  |--Compute Scalar(DEFINE:([Expr1031]=CASE WHEN [Expr1003] THEN (1) ELSE (0) END, [Expr1032]=CASE WHEN [Expr1004] AND [Expr1005] THEN (1) ELSE (0) END))
0      0             |                                       |--Compute Scalar(DEFINE:([Expr1025]=(29), [Expr1026]=(39), [Expr1027]=(49)))
0      0             |                                            |--Compute Scalar(DEFINE:([Expr1003]=CASE WHEN [T].[B] = (29) THEN (1) ELSE (0) END, [Expr1004]=CASE WHEN [T].[C] = (39) THEN (1) ELSE (0) END, [Expr1005]=CASE WHEN [T].[D] = (49) THEN (1) ELSE (0) END))
1      1             |                                                 |--Top(ROWCOUNT est 10000)
1      1             |                                                      |--Clustered Index Scan(OBJECT:([T].[TPK]), ORDERED FORWARD)
2 1             |--Index Update(OBJECT:([T].[TCD]), SET:([PK1038] = [T].[PK],[C1039] = [T].[C],[D1040] = [T].[D]) WITH ORDERED PREFETCH)
2 1                  |--Filter(WHERE:(NOT [Expr1032]))
2      1                       |--Sort(ORDER BY:([T].[C] ASC, [T].[D] ASC, [T].[PK] ASC, [Act1035] ASC))
2      1                            |--Table Spool


Let's review the various operators in this query plan.  First, observe that the portion between the clustered index scan and clustered index update operators looks essentially identical to the per-row plan from my last post.  In particular, notice how we have similar compute scalars to compute which indexes have really changed and need to be updated.  [Expr1031] indicates whether index TB must be updated and [Expr1032] indicates whether index TCD must be updated.  The only real difference between this portion of the plan and a per-row plan is that in this plan the clustered index update only updates the clustered index and does not update either of the non-clustered indexes.  The non-clustered indexes are updated by separate index update operators.


Next, we have a split operator.  The split operator converts a single row update into a delete followed by an insert.  This is why a single input row to the split turns into two output rows.  The split and sort operators in this plan are purely for performance and can be ignored for the purpose of this discussion.


The table spool is a common subexpression spool.  It eagerly consumes all of its input rows and then plays back these rows multiple times.  In this example, the spool plays back its rows twice: once for the update of index TB and once for the update of index TCD.  Note that the table spool below the index update of TCD is a secondary spool.  It has no input.  Instead, it plays back the rows from the primary table spool which is located between the index update of TB and the clustered index update.


The sequence operator glues the two portions of the plan together.  As its name suggests, it executes each child subtree in a sequential fashion.


Finally, the filter operators are new in SQL Server 2005.  They check the results of the compute scalars to determine whether each non-clustered index needs to be updated for each row.  In this example, both indexes need to be updated for the single row we are updating and so we see that the row passes through the filters and the index update operators each process two rows.  (Recall that the split converted the single row update into two rows: a delete followed by an insert.)


If we repeat the same update, we can see that this time the filters discard the rows as the data is not changing and the non-clustered indexes do not need to be updated.  Notice that both index update operators process no rows:


Rows   Executes
0      1        |--Sequence
0 1             |--Index Update(OBJECT:([T].[TB]), SET:([PK1036] = [T].[PK],[B1037] = [T].[B]) WITH ORDERED PREFETCH)
0 1             |    |--Sort(ORDER BY:([T].[B] ASC, [T].[PK] ASC, [Act1035] ASC))
0 1             |         |--Filter(WHERE:(NOT [Expr1031]))
2      1             |              |--Table Spool
2      1             |                   |--Split
1      1             |                        |--Clustered Index Update(OBJECT:([T].[TPK]), SET:([T].[B] = [Expr1025],[T].[C] = [Expr1026],[T].[D] = [Expr1027]))
1      1             |                             |--Compute Scalar(DEFINE:([Expr1031]=[Expr1031], [Expr1032]=[Expr1032]))
0      0             |                                  |--Compute Scalar(DEFINE:([Expr1031]=CASE WHEN [Expr1003] THEN (1) ELSE (0) END, [Expr1032]=CASE WHEN [Expr1004] AND [Expr1005] THEN (1) ELSE (0) END))
0      0             |                                       |--Compute Scalar(DEFINE:([Expr1025]=(29), [Expr1026]=(39), [Expr1027]=(49)))
0      0             |                                            |--Compute Scalar(DEFINE:([Expr1003]=CASE WHEN [T].[B] = (29) THEN (1) ELSE (0) END, [Expr1004]=CASE WHEN [T].[C] = (39) THEN (1) ELSE (0) END, [Expr1005]=CASE WHEN [T].[D] = (49) THEN (1) ELSE (0) END))
1      1             |                                                 |--Top(ROWCOUNT est 10000)
1      1             |                                                      |--Clustered Index Scan(OBJECT:([T].[TPK]), ORDERED FORWARD)
0 1             |--Index Update(OBJECT:([T].[TCD]), SET:([PK1038] = [T].[PK],[C1039] = [T].[C],[D1040] = [T].[D]) WITH ORDERED PREFETCH)
0 1                  |--Filter(WHERE:(NOT [Expr1032]))
2      1                       |--Sort(ORDER BY:([T].[C] ASC, [T].[D] ASC, [T].[PK] ASC, [Act1035] ASC))
2      1                            |--Table Spool


We could also use the other techniques which I demonstrated in my previous post (that is, checking the sys.dm_db_index_operational_stats DMV, checking locks held, and checking logical reads) to verify that the non-clustered indexes were not really updated.  I'll leave trying these other techniques as an exercise.

%3CLINGO-SUB%20id%3D%22lingo-sub-383316%22%20slang%3D%22en-US%22%3EOptimized%20Non-clustered%20Index%20Maintenance%20in%20Per-Index%20Plans%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-383316%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Aug%2022%2C%202007%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EIn%20%3CA%20href%3D%22http%3A%2F%2Fblogs.msdn.com%2Fcraigfr%2Farchive%2F2007%2F08%2F15%2Foptimized-non-clustered-index-maintenance.aspx%22%20title%3D%22Optimized%20Non-clustered%20Index%20Maintenance%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20my%20last%20post%20%3C%2FA%3E%20%2C%20I%20showed%20how%20SQL%20Server%202005%20only%20updates%20non-clustered%20indexes%20when%20the%20data%20in%20the%20index%20actually%20changes.%26nbsp%3B%20For%20my%20example%2C%20I%20used%20a%20simple%20update%20statement%20that%20results%20in%20a%20per-row%20or%20narrow%20plan.%26nbsp%3B%20In%20this%20post%2C%20I'll%20show%20how%20this%20optimization%20works%20in%20a%20per-index%20or%20wide%20update%20plan.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ELet's%20use%20the%20same%20schema%20and%20update%20statement%20from%20last%20week.%26nbsp%3B%20To%20get%20a%20per-index%20plan%2C%20we%20can%20trick%20the%20optimizer%20into%20believing%20that%20the%20table%20is%20much%20larger%20than%20it%20really%20is%20by%20running%20some%20UPDATE%20STATISTICS%20statements%20with%20the%20ROWCOUNT%20and%20PAGECOUNT%20options.%26nbsp%3B%20(We%20could%2C%20of%20course%2C%20make%20the%20table%20larger%20by%20actually%20inserting%20more%20rows%2C%20but%20the%20UPDATE%20STATISTICS%20route%20is%20faster.)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ECREATE%20TABLE%20T%20(PK%20INT%2C%20A%20INT%2C%20B%20INT%2C%20C%20INT%2C%20D%20INT%2C%20E%20INT)%20%3CBR%20%2F%3E%20CREATE%20UNIQUE%20CLUSTERED%20INDEX%20TPK%20ON%20T(PK)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ECREATE%20INDEX%20TB%20ON%20T(B)%20%3CBR%20%2F%3E%20CREATE%20INDEX%20TCD%20ON%20T(C%2CD)%20%3CBR%20%2F%3E%20CREATE%20INDEX%20TE%20ON%20T(E)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EINSERT%20T%20VALUES(0%2C%2010%2C%2020%2C%2030%2C%2040%2C%2050)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EUPDATE%20STATISTICS%20T%20WITH%20ROWCOUNT%20%3D%20100000%2C%20PAGECOUNT%20%3D%2010000%20%3CBR%20%2F%3E%20UPDATE%20STATISTICS%20T%20(TB)%20WITH%20ROWCOUNT%20%3D%20100000%2C%20PAGECOUNT%20%3D%201000%20%3CBR%20%2F%3E%20UPDATE%20STATISTICS%20T%20(TCD)%20WITH%20ROWCOUNT%20%3D%20100000%2C%20PAGECOUNT%20%3D%201000%20%3CBR%20%2F%3E%20UPDATE%20STATISTICS%20T%20(TE)%20WITH%20ROWCOUNT%20%3D%20100000%2C%20PAGECOUNT%20%3D%201000%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ESET%20STATISTICS%20PROFILE%20ON%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EUPDATE%20T%20SET%20B%20%3D%2029%2C%20C%20%3D%2039%2C%20D%20%3D%2049%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EBy%20running%20this%20statement%20with%20SET%20STATISTICS%20PROFILE%20ON%2C%20we%20can%20see%20the%20exact%20number%20of%20rows%20processed%20by%20each%20index%20update%20operator%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ERows%26nbsp%3B%26nbsp%3B%20Executes%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%7C--Sequence%20%3CBR%20%2F%3E%20%3CSTRONG%3E%202%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Index%20Update(OBJECT%3A(%5BT%5D.%5BTB%5D)%2C%20SET%3A(%5BPK1036%5D%20%3D%20%5BT%5D.%5BPK%5D%2C%5BB1037%5D%20%3D%20%5BT%5D.%5BB%5D)%20WITH%20ORDERED%20PREFETCH)%20%3CBR%20%2F%3E%20%3CSTRONG%3E%202%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Sort(ORDER%20BY%3A(%5BT%5D.%5BB%5D%20ASC%2C%20%5BT%5D.%5BPK%5D%20ASC%2C%20%5BAct1035%5D%20ASC))%20%3CBR%20%2F%3E%20%3CSTRONG%3E%202%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Filter(WHERE%3A(NOT%20%5BExpr1031%5D))%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Table%20Spool%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Split%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Clustered%20Index%20Update(OBJECT%3A(%5BT%5D.%5BTPK%5D)%2C%20SET%3A(%5BT%5D.%5BB%5D%20%3D%20%5BExpr1025%5D%2C%5BT%5D.%5BC%5D%20%3D%20%5BExpr1026%5D%2C%5BT%5D.%5BD%5D%20%3D%20%5BExpr1027%5D))%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1031%5D%3D%5BExpr1031%5D%2C%20%5BExpr1032%5D%3D%5BExpr1032%5D))%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1031%5D%3DCASE%20WHEN%20%5BExpr1003%5D%20THEN%20(1)%20ELSE%20(0)%20END%2C%20%5BExpr1032%5D%3DCASE%20WHEN%20%5BExpr1004%5D%20AND%20%5BExpr1005%5D%20THEN%20(1)%20ELSE%20(0)%20END))%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1025%5D%3D(29)%2C%20%5BExpr1026%5D%3D(39)%2C%20%5BExpr1027%5D%3D(49)))%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1003%5D%3DCASE%20WHEN%20%5BT%5D.%5BB%5D%20%3D%20(29)%20THEN%20(1)%20ELSE%20(0)%20END%2C%20%5BExpr1004%5D%3DCASE%20WHEN%20%5BT%5D.%5BC%5D%20%3D%20(39)%20THEN%20(1)%20ELSE%20(0)%20END%2C%20%5BExpr1005%5D%3DCASE%20WHEN%20%5BT%5D.%5BD%5D%20%3D%20(49)%20THEN%20(1)%20ELSE%20(0)%20END))%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Top(ROWCOUNT%20est%2010000)%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Clustered%20Index%20Scan(OBJECT%3A(%5BT%5D.%5BTPK%5D)%2C%20ORDERED%20FORWARD)%20%3CBR%20%2F%3E%20%3CSTRONG%3E%202%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Index%20Update(OBJECT%3A(%5BT%5D.%5BTCD%5D)%2C%20SET%3A(%5BPK1038%5D%20%3D%20%5BT%5D.%5BPK%5D%2C%5BC1039%5D%20%3D%20%5BT%5D.%5BC%5D%2C%5BD1040%5D%20%3D%20%5BT%5D.%5BD%5D)%20WITH%20ORDERED%20PREFETCH)%20%3CBR%20%2F%3E%20%3CSTRONG%3E%202%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Filter(WHERE%3A(NOT%20%5BExpr1032%5D))%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Sort(ORDER%20BY%3A(%5BT%5D.%5BC%5D%20ASC%2C%20%5BT%5D.%5BD%5D%20ASC%2C%20%5BT%5D.%5BPK%5D%20ASC%2C%20%5BAct1035%5D%20ASC))%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7C--Table%20Spool%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ELet's%20review%20the%20various%20operators%20in%20this%20query%20plan.%26nbsp%3B%20First%2C%20observe%20that%20the%20portion%20between%20the%20clustered%20index%20scan%20and%20clustered%20index%20update%20operators%20looks%20essentially%20identical%20to%20the%20per-row%20plan%20from%20my%20last%20post.%26nbsp%3B%20In%20particular%2C%20notice%20how%20we%20have%20similar%20compute%20scalars%20to%20compute%20which%20indexes%20have%20really%20changed%20and%20need%20to%20be%20updated.%26nbsp%3B%20%5BExpr1031%5D%20indicates%20whether%20index%20TB%20must%20be%20updated%20and%20%5BExpr1032%5D%20indicates%20whether%20index%20TCD%20must%20be%20updated.%20%26nbsp%3BThe%20only%20real%20difference%20between%20this%20portion%20of%20the%20plan%20and%20a%20per-row%20plan%20is%20that%20in%20this%20plan%20the%20clustered%20index%20update%20only%20updates%20the%20clustered%20index%20and%20does%20not%20update%20either%20of%20the%20non-clustered%20indexes.%26nbsp%3B%20The%20non-clustered%20indexes%20are%20updated%20by%20separate%20index%20update%20operators.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ENext%2C%20we%20have%20a%20split%20operator.%26nbsp%3B%20The%20split%20operator%20converts%20a%20single%20row%20update%20into%20a%20delete%20followed%20by%20an%20insert.%26nbsp%3B%20This%20is%20why%20a%20single%20input%20row%20to%20the%20split%20turns%20into%20two%20output%20rows.%26nbsp%3B%20The%20split%20and%20sort%20operators%20in%20this%20plan%20are%20purely%20for%20performance%20and%20can%20be%20ignored%20for%20the%20purpose%20of%20this%20discussion.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20table%20spool%20is%20a%20common%20subexpression%20spool.%26nbsp%3B%20It%20eagerly%20consumes%20all%20of%20its%20input%20rows%20and%20then%20plays%20back%20these%20rows%20multiple%20times.%26nbsp%3B%20In%20this%20example%2C%20the%20spool%20plays%20back%20its%20rows%20twice%3A%20once%20for%20the%20update%20of%20index%20TB%20and%20once%20for%20the%20update%20of%20index%20TCD.%26nbsp%3B%20Note%20that%20the%20table%20spool%20below%20the%20index%20update%20of%20TCD%20is%20a%20secondary%20spool.%26nbsp%3B%20It%20has%20no%20input.%26nbsp%3B%20Instead%2C%20it%20plays%20back%20the%20rows%20from%20the%20primary%20table%20spool%20which%20is%20located%20between%20the%20index%20update%20of%20TB%20and%20the%20clustered%20index%20update.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20sequence%20operator%20glues%20the%20two%20portions%20of%20the%20plan%20together.%26nbsp%3B%20As%20its%20name%20suggests%2C%20it%20executes%20each%20child%20subtree%20in%20a%20sequential%20fashion.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EFinally%2C%20the%20filter%20operators%20are%20new%20in%20SQL%20Server%202005.%26nbsp%3B%20They%20check%20the%20results%20of%20the%20compute%20scalars%20to%20determine%20whether%20each%20non-clustered%20index%20needs%20to%20be%20updated%20for%20each%20row.%26nbsp%3B%20In%20this%20example%2C%20both%20indexes%20need%20to%20be%20updated%20for%20the%20single%20row%20we%20are%20updating%20and%20so%20we%20see%20that%20the%20row%20passes%20through%20the%20filters%20and%20the%20index%20update%20operators%20each%20process%20two%20rows.%26nbsp%3B%20(Recall%20that%20the%20split%20converted%20the%20single%20row%20update%20into%20two%20rows%3A%20a%20delete%20followed%20by%20an%20insert.)%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIf%20we%20repeat%20the%20same%20update%2C%20we%20can%20see%20that%20this%20time%20the%20filters%20discard%20the%20rows%20as%20the%20data%20is%20not%20changing%20and%20the%20non-clustered%20indexes%20do%20not%20need%20to%20be%20updated.%26nbsp%3B%20Notice%20that%20both%26nbsp%3Bindex%20update%20operators%20process%20no%20rows%3A%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ERows%26nbsp%3B%26nbsp%3B%20Executes%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%7C--Sequence%20%3CBR%20%2F%3E%20%3CSTRONG%3E%200%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Index%20Update(OBJECT%3A(%5BT%5D.%5BTB%5D)%2C%20SET%3A(%5BPK1036%5D%20%3D%20%5BT%5D.%5BPK%5D%2C%5BB1037%5D%20%3D%20%5BT%5D.%5BB%5D)%20WITH%20ORDERED%20PREFETCH)%20%3CBR%20%2F%3E%20%3CSTRONG%3E%200%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Sort(ORDER%20BY%3A(%5BT%5D.%5BB%5D%20ASC%2C%20%5BT%5D.%5BPK%5D%20ASC%2C%20%5BAct1035%5D%20ASC))%20%3CBR%20%2F%3E%20%3CSTRONG%3E%200%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Filter(WHERE%3A(NOT%20%5BExpr1031%5D))%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Table%20Spool%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Split%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Clustered%20Index%20Update(OBJECT%3A(%5BT%5D.%5BTPK%5D)%2C%20SET%3A(%5BT%5D.%5BB%5D%20%3D%20%5BExpr1025%5D%2C%5BT%5D.%5BC%5D%20%3D%20%5BExpr1026%5D%2C%5BT%5D.%5BD%5D%20%3D%20%5BExpr1027%5D))%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1031%5D%3D%5BExpr1031%5D%2C%20%5BExpr1032%5D%3D%5BExpr1032%5D))%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1031%5D%3DCASE%20WHEN%20%5BExpr1003%5D%20THEN%20(1)%20ELSE%20(0)%20END%2C%20%5BExpr1032%5D%3DCASE%20WHEN%20%5BExpr1004%5D%20AND%20%5BExpr1005%5D%20THEN%20(1)%20ELSE%20(0)%20END))%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1025%5D%3D(29)%2C%20%5BExpr1026%5D%3D(39)%2C%20%5BExpr1027%5D%3D(49)))%20%3CBR%20%2F%3E%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7C--Compute%20Scalar(DEFINE%3A(%5BExpr1003%5D%3DCASE%20WHEN%20%5BT%5D.%5BB%5D%20%3D%20(29)%20THEN%20(1)%20ELSE%20(0)%20END%2C%20%5BExpr1004%5D%3DCASE%20WHEN%20%5BT%5D.%5BC%5D%20%3D%20(39)%20THEN%20(1)%20ELSE%20(0)%20END%2C%20%5BExpr1005%5D%3DCASE%20WHEN%20%5BT%5D.%5BD%5D%20%3D%20(49)%20THEN%20(1)%20ELSE%20(0)%20END))%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Top(ROWCOUNT%20est%2010000)%20%3CBR%20%2F%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Clustered%20Index%20Scan(OBJECT%3A(%5BT%5D.%5BTPK%5D)%2C%20ORDERED%20FORWARD)%20%3CBR%20%2F%3E%20%3CSTRONG%3E%200%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7C--Index%20Update(OBJECT%3A(%5BT%5D.%5BTCD%5D)%2C%20SET%3A(%5BPK1038%5D%20%3D%20%5BT%5D.%5BPK%5D%2C%5BC1039%5D%20%3D%20%5BT%5D.%5BC%5D%2C%5BD1040%5D%20%3D%20%5BT%5D.%5BD%5D)%20WITH%20ORDERED%20PREFETCH)%20%3CBR%20%2F%3E%20%3CSTRONG%3E%200%20%3C%2FSTRONG%3E%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Filter(WHERE%3A(NOT%20%5BExpr1032%5D))%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%7C--Sort(ORDER%20BY%3A(%5BT%5D.%5BC%5D%20ASC%2C%20%5BT%5D.%5BD%5D%20ASC%2C%20%5BT%5D.%5BPK%5D%20ASC%2C%20%5BAct1035%5D%20ASC))%20%3CBR%20%2F%3E%202%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%201%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C--Table%20Spool%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EWe%20could%20also%20use%20the%20other%20techniques%20which%20I%20demonstrated%20in%20my%20previous%20post%20(that%20is%2C%20checking%20the%20sys.dm_db_index_operational_stats%20DMV%2C%20checking%20locks%20held%2C%20and%20checking%20logical%20reads)%20to%20verify%20that%20the%20non-clustered%20indexes%20were%20not%20really%20updated.%26nbsp%3B%20I'll%20leave%20trying%20these%20other%20techniques%20as%20an%20exercise.%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-383316%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Aug%2022%2C%202007%20In%20my%20last%20post%2C%20I%20showed%20how%20SQL%20Server%202005%20only%20updates%20non-clustered%20indexes%20when%20the%20data%20in%20the%20index%20actually%20changes.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-383316%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQLServerQueryProcessing%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Mar 23 2019 05:07 AM
Updated by: