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.

Related Posts

Resumable Online Index Rebuild

Arun Sirpal shows off a SQL Server 2017 and Azure SQL Database feature: Clearly I am in a paused state with 5.48% percent of the operation complete. In the original query window where I started the index rebuild, I receive: Msg 1219, Level 16, State 1, Line 4 Your session has been disconnected because of […]

Read More

Set A Fill Factor

Monica Rathbun wants you to set a better fill factor than the default: Please, please, please Admins do not leave your default index fill factor at 0. This means you are telling SQL Server to fill the page 100% full when creating indexes. This also means you are forcing it to a new page when […]

Read More

1 Comment

  • Gail on 2016-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

Categories

January 2016
MTWTFSS
« Dec Feb »
 123
45678910
11121314151617
18192021222324
25262728293031