17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Navigating the Tree<br />

Figure 9-4<br />

As I’ve indicated previously, even the indexes in <strong>SQL</strong> <strong>Server</strong> are stored in a B-Tree. Theoretically, a<br />

B-Tree always has half of the remaining information in each possible direction as the tree branches. Let’s<br />

take a look at a visualization of what a B-Tree looks like for a clustered index (Figure 9-5).<br />

Root<br />

Non-Leaf<br />

Level<br />

Leaf Level<br />

is Data Page<br />

Figure 9-5<br />

1<br />

2<br />

52<br />

Fred<br />

Sally<br />

Steve<br />

Chapter 9: <strong>SQL</strong> <strong>Server</strong> Storage and Index Structures<br />

1<br />

2<br />

3<br />

4<br />

5<br />

53<br />

54<br />

103<br />

×<br />

1<br />

53<br />

104<br />

Bob<br />

Sam<br />

George<br />

Ordered insert as last record<br />

in a Cluster Key<br />

5<br />

104<br />

105<br />

156<br />

Bruce<br />

Sue<br />

New record to be inserted<br />

but the page is full. Since it<br />

is last, it is added to an<br />

entirely new page without<br />

disturbing the existing data.<br />

1<br />

157<br />

157<br />

158<br />

269<br />

Looking for Records<br />

158 through 400<br />

Tom<br />

Ashley<br />

Ralph<br />

270<br />

271<br />

400<br />

401<br />

157<br />

270<br />

410<br />

Bill<br />

Margot<br />

Tom<br />

411<br />

412<br />

Mike<br />

Nancy<br />

271

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!