I am trying to understand the effect that forcing the update of statistics with a fullscan has on execution plan estimates.
I currently have the following result in the execution plan for a very simple SELECT query:
As you can see it is off by 5 rows.
I then run:
UPDATE STATISTICS Person.Address WITH FULLSCAN
UPDATE STATISTICS Person.Address [PK_Address_AddressID] WITH FULLSCAN
GO
EXEC sp_recompile 'Person.Address';
GO
SELECT * FROM Person.Address OPTION(RECOMPILE)
However, it is still off by 5 rows.
Why?
I know I shouldn't worry unless there is a performance problem. However, I am trying to understand the actual effect of a complete statistics update
Best Answer
Row count appears to only hold 6 significant digits of information (apparently called a mantissa for a float).
Consider the below example, which has a table with 11,111,111 rows. However, estimated rows is only displayed as 11,111,100.
Interestingly, the stats object shows all 11,111,111 rows.
By adding TF 2363, you can see that the rounding occurs during the cardinality estimation process.