
Strange Statistics I/O Results
I've got a relatively simple query -
select s.EDIBrchCd, S.ProdCd, B.Name
from ScrubError s, Branch b
where b.Hqid='ABC1234'
and s.EDIBrchCd = b.BrchId
(A headquarter contains many branches - I want everything in
the
ScrubError table for a single headquarter id....)
The showplan shows an access to the Branch table first, using a
non-clustered index on Hqid (there is only one qualifying
resulting row
in this case,) then does a nested-iteration to ScrubError using
another
non-clustered index on EDIBrchCd (there are NO rows in
ScrubError from
the resulting branch-id) - the query plan seems VERY
REASONABLE...however,
The statistics io show 42837 logical reads to ScrubError (!!!!
-
coincidentally the number of total rows in ScrubError), and 3
to Branch
(this part seems ok.)
Can somebody explain the 42837 number to me?? Seems like with
the
non-clustered index, it should be doing about 2 or 3 reads.
It's really
difficult to optimize when the 'optimizer' is giving strange
results.
Thanks,