Thanks Simon for you input,
I've started running some tests with a table with a table having two columns and 10001 rows
create table simon (numero numeric(10,6),nom varchar(50))
-- default lock scheme is datarows
this table has an index on simon(numero)
Before executing the next SQL for testing i set the following flags
set statistics io, time, plancost
set showplan on
set option show_lio_costing on
dbcc traceon(3604,9528)
select * from simon where numero between 90 and 94
Maybe you could help me understanding the output?
Beginning selection of qualifying indexes for table 'simon',
Estimating selectivity of index 'simon.simon_nd0', indid 2
numero >= 90.000000
numero <= 94.000000
Estimated selectivity for numero,
selectivity = 0.003413662,
scan selectivity 0.003413662, filter selectivity 0.003413662
34.14003 rows, 1 pages
Data Row Cluster Ratio 0.01049763
Index Page Cluster Ratio 1
Data Page Cluster Ratio 0.07202833
using no index prefetch (size 4K I/O)
in index cache 'default data cache' (cacheid 0) with LRU replacement
using no table prefetch (size 4K I/O)
in data cache 'default data cache' (cacheid 0) with LRU replacement
Data Page LIO for 'simon_nd0' on table 'simon' = 34.14003
I put in bold, the part I'm not sure of.
My understanding is
if I look at the histogram
46 0.00199980 <= 89.977648
47 0.00199980 <= 92.350715
48 0.00199980 <= 94.652860
49 0.00199980 <= 96.226424
I have almost two range corresponding to my between so an estimation of 0.00199980 * 2 = 0.0039996 which is not too far from 0.003413662
If I multiply this selectivity with the total number of rows we basically have 34 rows to be returned which correspond to 1 page, am I correct? (how is compute this 1 pages?)
Then is displayed some information from optdiag and the fact that prefect won't be used.
Then I don't understand how 'Data Page LIO for 'simon_nd0' on table 'simon' = 34.14003' is computed.
Could you highlight me on this?
Thanks in advance.
Simon