Press "Enter" to skip to content

Index Scans

Gail Shaw proves that sometimes, an index scan isn’t a full index scan:

A scan of the entire index is over 1600 pages. This query read three. It’s a scan, but it’s a scan which stopped after reading one page of the leaf (the other two are likely the root and intermediate pages, used to locate the first page in the leaf).

The scan read one row and then stopped, because that’s all that was needed. It did that, because there was a 1 row row-goal added to the query. For more details on row goals, see Paul White’s article on the subject.

Read the whole thing.

Corollary:  sometimes a seek isn’t really a seek; sometimes it’s a scan even when the icon says “seek” because that’s more efficient.

One Comment

  1. Gail
    Gail2016-01-27

    No, a seek is always a seek. But ‘seek’ doesn’t mean efficient and doesn’t mean ‘one page’. It means that the b-tree was used to locate a value or start of a range. That’s all that ‘seek’ means

Comments are closed.