Databases Reference
In-Depth Information
sample). You can optionally test replacing the 10,000 with some other values, like 10, 100,
1,000, or 5,000, and compare the actual and the estimated number of rows returned.
Figure 3-10: Cardinality estimation example using computed columns.
Note that creating the computed column does not create statistics; these statistics are
created the first time that the query is optimized, and you can run the next query to
display the information about the statistics objects for the Sales.SalesOrderDetail
table:
SELECT * FROM sys . stats
WHERE object_id = object_id ( 'Sales.SalesOrderDetail' )
Listing 3-34.
The newly created statistics object will most likely be at the end of the list. Copy the name
of the object, and use the following command to display the details about the statistics
object (I've used the name of my local object, but you should replace that as appropriate).
You can also use "cc" as the name of the object to get the same results. The "cc" column
should be shown on the Columns field in the density section.
DBCC SHOW_STATISTICS ( 'Sales.SalesOrderDetail' , _WA_Sys_00000013_2645B050 )
Listing 3-35.
Search WWH ::




Custom Search