Quantcast
Viewing all articles
Browse latest Browse all 3587

Re: hands on 'optimizer', optdiag statistics...

Interpolation is the process of determining mathematically where your range of 90-94 falls within the histogram.  Basically, you start by finding a percentage of the weight where the lower bound falls between the cells, and multiply that by the weight of the cell.  In this case, Cell 47:

 

0.00199980 * ( 1.000000 - ( (90.000000 - 89.977648)/ (92.350715 - 89.977648)) ) = 0.001981

 

Then, add the values of the weights of each cell within the range (in this case, there are none as there are only 2 cells, lower bound cell 47, and upper bound cell 48) until you reach the cell of the upper bound, and do another percentage calculation (cell 48):

 

0.00199980 *  ( (94.000000 - 92.350715)/ (94.652860 - 92.350715))  = 0.001433

 

 

0.001981 + 0.001433 = 0.003414

 

This is your scan selectivity (rounded to 6 places in my math because of your displayed statistics precision).  Using the precision of the real data it's actually 0.003413662.  Multiply scan selectivity times your number of rows:

 

0.003413662 * 10001 = 34.140033662

 

So, the optimizer estimates that  approx 34.14003 rows match your bounded range criteria.  The output above is estimating how much IO will be necessary to read the index values (1 page of non-clustered index pages, as index pages only contain the key value, and a pointer to the data row), and for each matching index row, then accessing an entry in the base table.   So, Data Page LIO is the logical io for 34 rows to the base table.   Non-clustered index is a separate physical structure, and each entry points to a row in the base table which is itself a separate physical structure.


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>