Databases Reference
In-Depth Information
Figure 3-13: Cardinality estimation example using a small table.
We can discover where the Query Optimizer is getting the estimated number of rows by
inspecting the statistics object. Run this query to see the name of the statistics object ...
SELECT * FROM sys . stats
WHERE object_id = object_id ( 'dbo.Address' )
Listing 3-52.
... and then use the displayed statistics object name in the following statement (the name
may be different in your case).
DBCC SHOW_STATISTICS ( 'dbo.Address' , _WA_Sys_00000004_46136164 )
Listing 3-53.
A fragment of the histogram is shown next.
RANGE_HI_KEY RANGE_ROWS EQ_ROWS DISTINCT_RANGE_ROWS AVG_RANGE_ROWS
------------- ---------- ------- ------------------- --------------
Lincoln Acres 0 102 0 1
London 32 434 2 16
Long Beach 0 97 0 1
Los Angeles 2 93 2 1
Listing 3-54.
Search WWH ::




Custom Search