Tweeted twitter.com/StackDBAs/status/954571407467466752
2 added 93 characters in body
source | link

I've been trying out running some queries for a testing scenario and I noticed that when doing a full-scan of a nonclustered index, SQL Server reads more pages than actually are in the index.

As you can see from the image below, my query is (a simple one):

select
    sometext
    , somemoretext
from tbl

and I have an exact covering nonclustered index for those columns.

enter image description here

In Profiler the number of pages read for this is 22,356 as you can see in the image.

But when looking at the index details, under Fragmentation, the number of pages for this index is 22,278.

enter image description here

What is the cause for this difference in pages read (78 to be precise)? Is the number in the Fragmentation section not reliable or is there some other explanation?

The index is not fragmented (or appears not to be), so there are no more pages than those 22,278 .. or are there? I wasn't able to find an explanation for this online, on Microsoft sites or otherwise.

(This is a controlled environment, no inserts and no deletes occurred on the table while taking screenshots for this question)

I have also pasted the plan here.

I've been trying out running some queries for a testing scenario and I noticed that when doing a full-scan of a nonclustered index, SQL Server reads more pages than actually are in the index.

As you can see from the image below, my query is (a simple one):

select
    sometext
    , somemoretext
from tbl

and I have an exact covering nonclustered index for those columns.

enter image description here

In Profiler the number of pages read for this is 22,356 as you can see in the image.

But when looking at the index details, under Fragmentation, the number of pages for this index is 22,278.

enter image description here

What is the cause for this difference in pages read (78 to be precise)? Is the number in the Fragmentation section not reliable or is there some other explanation?

The index is not fragmented (or appears not to be), so there are no more pages than those 22,278 .. or are there? I wasn't able to find an explanation for this online, on Microsoft sites or otherwise.

(This is a controlled environment, no inserts and no deletes occurred on the table while taking screenshots for this question)

I've been trying out running some queries for a testing scenario and I noticed that when doing a full-scan of a nonclustered index, SQL Server reads more pages than actually are in the index.

As you can see from the image below, my query is (a simple one):

select
    sometext
    , somemoretext
from tbl

and I have an exact covering nonclustered index for those columns.

enter image description here

In Profiler the number of pages read for this is 22,356 as you can see in the image.

But when looking at the index details, under Fragmentation, the number of pages for this index is 22,278.

enter image description here

What is the cause for this difference in pages read (78 to be precise)? Is the number in the Fragmentation section not reliable or is there some other explanation?

The index is not fragmented (or appears not to be), so there are no more pages than those 22,278 .. or are there? I wasn't able to find an explanation for this online, on Microsoft sites or otherwise.

(This is a controlled environment, no inserts and no deletes occurred on the table while taking screenshots for this question)

I have also pasted the plan here.

1
source | link

Why does an index scan read more pages than exist in an index?

I've been trying out running some queries for a testing scenario and I noticed that when doing a full-scan of a nonclustered index, SQL Server reads more pages than actually are in the index.

As you can see from the image below, my query is (a simple one):

select
    sometext
    , somemoretext
from tbl

and I have an exact covering nonclustered index for those columns.

enter image description here

In Profiler the number of pages read for this is 22,356 as you can see in the image.

But when looking at the index details, under Fragmentation, the number of pages for this index is 22,278.

enter image description here

What is the cause for this difference in pages read (78 to be precise)? Is the number in the Fragmentation section not reliable or is there some other explanation?

The index is not fragmented (or appears not to be), so there are no more pages than those 22,278 .. or are there? I wasn't able to find an explanation for this online, on Microsoft sites or otherwise.

(This is a controlled environment, no inserts and no deletes occurred on the table while taking screenshots for this question)