Beginning Microsoft SQL Server 2008 ... - S3 Tech Training
Beginning Microsoft SQL Server 2008 ... - S3 Tech Training Beginning Microsoft SQL Server 2008 ... - S3 Tech Training
Figure 9-1 Figure 9-2 1 53 104 Root Non-Leaf Level 534 600 755 1 157 534 157 270 410 157 190 210 230 250 261 Leaf Level 410 430 450 475 510 521 270 310 335 360 380 1 10 20 30 41 104 110 121 130 140 53 65 78 90 98 534 545 557 570 588 755 780 795 825 847 860 600 621 641 680 720 1 2 3 4 5 Root Actual Data 6 7 8 9 10 11 12 13 14 15 1 6 11 16 16 17 18 266 Chapter 9: SQL Server Storage and Index Structures
Page Splits — A First Look All of this works quite nicely on the read side of the equation — it’s the insert that gets a little tricky. Recall that the B in B-Tree stands for balanced. You may also recall that I mentioned that a B-Tree is balanced because about half the data is on either side every time you run into a branch in the tree. B-Trees are sometimes referred to as self-balancing because the way new data is added to the tree generally prevents them from becoming lopsided. When data is added to the tree, a node will eventually become full and will need to split. Because in SQL Server, a node equates to a page, this is called a page split, illustrated in Figure 9-3. When a page split occurs, data is automatically moved around to keep things balanced. The first half of the data is left on the old page, and the rest of the data is added to a new page — thus you have about a 50-50 split, and your tree remains balanced. Figure 9-3 If you think about this splitting process a bit, you’ll realize that it adds a substantial amount of overhead at the time of the split. Instead of inserting just one page, you are: ❑ Creating a new page Chapter 9: SQL Server Storage and Index Structures ❑ Migrating rows from the existing page to the new page ❑ Adding your new row to one of the pages 2 4 6 8 2 4 5 6 8 ❑ Adding another entry in the parent node Ordered insert as middle record in a Cluster Key × 5 New record to be inserted, but the page is full. Since the new record needs to go in the middle, the page must be split. 267
- Page 253 and 254: 8 Being Normal: Normalization and O
- Page 255 and 256: Chapter 8: Being Normal: Normalizat
- Page 257 and 258: Chapter 8: Being Normal: Normalizat
- Page 259 and 260: Chapter 8: Being Normal: Normalizat
- Page 261 and 262: Chapter 8: Being Normal: Normalizat
- Page 263 and 264: Chapter 8: Being Normal: Normalizat
- Page 265 and 266: Chapter 8: Being Normal: Normalizat
- Page 267 and 268: Chapter 8: Being Normal: Normalizat
- Page 269 and 270: Chapter 8: Being Normal: Normalizat
- Page 271 and 272: Chapter 8: Being Normal: Normalizat
- Page 273 and 274: Chapter 8: Being Normal: Normalizat
- Page 275 and 276: Chapter 8: Being Normal: Normalizat
- Page 277 and 278: Chapter 8: Being Normal: Normalizat
- Page 279 and 280: Chapter 8: Being Normal: Normalizat
- Page 281 and 282: Chapter 8: Being Normal: Normalizat
- Page 283 and 284: Chapter 8: Being Normal: Normalizat
- Page 285 and 286: Chapter 8: Being Normal: Normalizat
- Page 287 and 288: Chapter 8: Being Normal: Normalizat
- Page 289 and 290: Chapter 8: Being Normal: Normalizat
- Page 291 and 292: Chapter 8: Being Normal: Normalizat
- Page 293 and 294: Chapter 8: Being Normal: Normalizat
- Page 295 and 296: Chapter 8: Being Normal: Normalizat
- Page 297 and 298: Chapter 8: Being Normal: Normalizat
- Page 299 and 300: 9 SQL Ser ver Storage and Index Str
- Page 301 and 302: Page Splits When a page becomes ful
- Page 303: The point here is that what happens
- Page 307 and 308: You may hear lots of bad things abo
- Page 309 and 310: Navigating the Tree Figure 9-4 As I
- Page 311 and 312: there was no link between the data.
- Page 313 and 314: Root Non-Leaf Level Leaf Level Figu
- Page 315 and 316: The CREATE INDEX Statement The CREA
- Page 317 and 318: FILLFACTOR When SQL Server first cr
- Page 319 and 320: works only if tempdb is on a separa
- Page 321 and 322: Secondary XML Indexes Chapter 9: SQ
- Page 323 and 324: occur, and that one or more non-lea
- Page 325 and 326: isn’t room on the page, SQL Serve
- Page 327 and 328: more administrator oriented and usu
- Page 329 and 330: The Database Engine Tuning Advisor
- Page 331 and 332: The output is far more self-describ
- Page 333 and 334: We use a FILLFACTOR when we need to
- Page 335: Chapter 9: SQL Server Storage and I
- Page 338 and 339: Chapter 10: Views The preceding syn
- Page 340 and 341: Chapter 10: Views 302 columns to a
- Page 342 and 343: Chapter 10: Views Try It Out Using
- Page 344 and 345: Chapter 10: Views 306 soh.SalesOrde
- Page 346 and 347: Chapter 10: Views AW00000676 43659
- Page 348 and 349: Chapter 10: Views NULL values will
- Page 350 and 351: Chapter 10: Views Editing V iews wi
- Page 352 and 353: Chapter 10: Views 314 There are fou
Figure 9-1<br />
Figure 9-2<br />
1<br />
53<br />
104<br />
Root<br />
Non-Leaf<br />
Level<br />
534<br />
600<br />
755<br />
1<br />
157<br />
534<br />
157<br />
270<br />
410<br />
157<br />
190<br />
210<br />
230<br />
250<br />
261<br />
Leaf<br />
Level<br />
410<br />
430<br />
450<br />
475<br />
510<br />
521<br />
270<br />
310<br />
335<br />
360<br />
380<br />
1<br />
10<br />
20<br />
30<br />
41<br />
104<br />
110<br />
121<br />
130<br />
140<br />
53<br />
65<br />
78<br />
90<br />
98<br />
534<br />
545<br />
557<br />
570<br />
588<br />
755<br />
780<br />
795<br />
825<br />
847<br />
860<br />
600<br />
621<br />
641<br />
680<br />
720<br />
1<br />
2<br />
3<br />
4<br />
5<br />
Root<br />
Actual<br />
Data<br />
6<br />
7<br />
8<br />
9<br />
10<br />
11<br />
12<br />
13<br />
14<br />
15<br />
1<br />
6<br />
11<br />
16<br />
16<br />
17<br />
18<br />
266<br />
Chapter 9: <strong>SQL</strong> <strong>Server</strong> Storage and Index Structures