I have created a test table with a single clustered index on it.CREATE DATABASE TestDB GOUSE TestDBGOcreate table test(id int identity(1,1) primary key clustered,name varchar(100),dt datetime)insert into test(name,dt)select s.name,DATEADD(dd,number,getdate()) from master..spt_values vcross join sysobjects swhere v.type='p'
Now when I use dm_db_index_physical_stats and the dm_db_index_operational_stats to check on the indexes on the table they showthe page count of 3874 with dm_db_index_physical_stats and dm_db_index_operational_stats also a non leaf allocation count of 15.select page_count from sys.dm_db_index_physical_stats(db_id('TestDB'),OBJECT_ID('test'),null,null,null)select leaf_allocation_count,nonleaf_allocation_countfrom sys.dm_db_index_operational_stats(DB_ID(), OBJECT_ID('dbo.test'),NULL, NULL) ios INNER JOIN sys.indexes i ON i.object_id = ios.object_id AND i.index_id = ios.index_id;
So now when I use a simple select set statistics io on;GOselect * from test
The statistics show the number of logical reads of 3890 which is summation of page count and non leaf allocation count.The summation comes to 3874+15=3889.But the logical reads are 3890.So my question what is that extra page that sql server uses?In case of highly fragmented table to the behavior is same.The query below will fragment the table to about 80%CREATE NONCLUSTERED INDEX [testindx1]ON [dbo].[test] ([dt])INCLUDE (id,name)GO update test set name=REPLICATE('X',10)
PBUH