Databases Reference
In-Depth Information
queries which are using these columns. Density information will also help on filters
and GROUP BY operations, as we'll see in the density section later on. Filtered statistics,
which are also explained later in this chapter, can also be used for cardinality estimation
problems with correlated columns.
Inspecting statistics objects
Let us see an example of a statistics object and inspect the data it stores. Existing statistics
for a specific object can be displayed using the sys.stats catalog view, as used in the
following query:
SELECT * FROM sys . stats
WHERE object_id = object_id ( 'Sales.SalesOrderDetail' )
Listing 3-1.
An output similar to that in Listing 3-2 (edited to fit the page) will be shown.
object_id name stats_id
--------- --------------------------------------------------- --------
642101328 PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID 1
642101328 AK_SalesOrderDetail_rowguid 2
642101328 IX_SalesOrderDetail_ProductID 3
Listing 3-2.
One record for each statistics object is shown. You can use the DBCC SHOW_STATISTICS
statement to display the details of a statistics object by specifying the column name or the
name of the statistics object.
Search WWH ::




Custom Search