statistics

Home/Tag: statistics

SQL Server Cardinality – Quick Notes, Part 3

Hi Friends, Read Part 1 & Part 2. SQL Server Cardinality Estimation is a complicated topic until you understand the internals of SQL Server Statistics. Here are some quick notes that will answer some common questions that you generally have: How does SQL Server Query Optimizer perform cardinality estimation in case of multiple columns? Let’s [...]

Cardinality Estimation in SQL Server – Quick Notes, Part 2

Hi Friends, A few days back I penned down a few quick notes about Cardinality Estimation in SQL Server. You can read Part 1 here. SQL Server Cardinality Estimation is a complicated topic until you understand the internals of SQL Server Statistics. Here are some quick notes that will answer some common questions that you [...]

SQL Server Cardinality Estimation – Quick Notes, Part 1

Hi Friends, SQL Server Cardinality Estimation is a complicated topic until you understand the internals of SQL Server Statistics. Here are some quick notes that will answer some common questions that you generally have: How does SQL Server Query Optimizer estimate a default cardinality? Let’s see and example (turn ON Actual Execution Plan or press [...]

SQL Server Statistics Histogram- How to Decode? (Statistics Internals)

Hi Friends, Here is a short explanation of the SQL Server statistics histogram. I am using AdventureWorks2008R2 database. There is a table Sales.SalesOrderHeader with a column TotalDue. Let us have a look at that column. USE AdventureWorks2008R2 GO -- first observe the rows select TotalDue from Sales.SalesOrderHeader GO select DISTINCT TotalDue from Sales.SalesOrderHeader GO You [...]