Database Reference
In-Depth Information
Listing 14-6. UDT performance: Adding a persisted calculated column
alter table dbo.AddressesCLR add State as Address.State persisted;
-- Repuild the index to reduce the fragmentation caused by alteration
alter index PK_AddressesCLR on dbo.AddressesCLR rebuild;
create index IDX_AddressesCLR_State on dbo.AddressesCLR(State);
create index IDX_Addresses_State on dbo.Addresses(State);
Now, if you run the queries from Listing 14-5 again, you will see the results shown in Figure 14-4 .
Figure 14-4. UDT performance: Persisted calculated column
There is still a Compute Scalar operator in the second execution plan, although this time it is not related to the
CLR method call, and it is used as the column reference placeholder, as shown in Figure 14-5 .
Figure 14-5. UDT performance: Computer Scalar operator with computed column
 
Search WWH ::




Custom Search