Download presentation
Presentation is loading. Please wait.
Published byMckayla Dowden Modified over 9 years ago
1
Disk Controller To disk subsystem Rotational Delay Seek time Disk Block Block Size Disk Characteristics Capacity Rotational Speed (RPM) Seek Time Interface (SCSI, ATA, Serial ATA, Serial Attached SCSI, Fiber Channel)
2
b6 C101 Smith Joe Hanover NJ C102 Green Ed Lodi NY b7b8b9 Disk Block Record 1Record 2 Field separator Record separator b10b11b12b13 Disk Block and Record Storage Disk Block Record size (Fixed / Variable) Spanned vs. Unspanned Blocking Factor
3
b6 b7b8b9 b6b7b8b9 R1R2R3R4R5R6 R1R2R3R4R5R6 Unspanned Record Organization Spanned Record Organization Spanned vs. Unspanned Record Organization
4
FNAME LNAME EMPID DNO SALARY JOHN SMITH 123456789 5 30000 FRANKLIN WONG 333445555 5 40000 JOYCE ENGLISH 453453453 5 25000 RAMESH NARAYAN 666884444 5 38000 JAMES BORG 888665555 1 55000 JENNIFER WALLACE 987654321 4 43000 AHMAD JABBAR 987987987 4 25000 ALICIA ZELAYA 999887777 4 25000 I-Field Block 123456789 101 453453453 102 888665555 103 987987987 104 Primary Index Block 101 102 103 104
5
FNAME LNAME EMPID DNO SALARY JOHN SMITH 123456789 5 30000 FRANKLIN WONG 333445555 5 40000 JOYCE ENGLISH 453453453 5 25000 RAMESH NARAYAN 666884444 5 38000 JAMES BORG 888665555 1 55000 JENNIFER WALLACE 987654321 4 43000 AHMAD JABBAR 987987987 4 25000 ALICIA ZELAYA 999887777 4 25000 I-Field Block Record Offset BORG 103 1 ENGLISH 102 1 JABBAR 104 1 NARAYAN 102 2 SMITH 101 1 WALLACE 103 2 WONG 101 2 ZELAYA 104 2 Secondary Index Block 101 102 103 104 Record Pointer
6
FNAME LNAME EMPID DNO SALARY JAMES BORG 888665555 1 55000 JENNIFER WALLACE 987654321 4 43000 AHMAD JABBAR 987987987 4 25000 ALICIA ZELAYA 999887777 4 25000 JOHN SMITH 123456789 5 30000 FRANKLIN WONG 333445555 5 40000 JOYCE ENGLISH 453453453 5 25000 RAMESH NARAYAN 666884444 5 38000 I-Field Block 1 101 4 101 5 103 Clustering Index Block 101 102 103 104 I-Field Block Record Offset BORG 101 1 ENGLISH 104 1 JABBAR 102 1 NARAYAN 104 2 SMITH 103 1 WALLACE 101 2 WONG 103 2 ZELAYA 102 2 Secondary Index Record Pointer
7
B Tree Index NARAYAN ENGLISH WALLACE BORG ENGLISH 101 104 JABBAR NARAYAN 102 104 SMITH WALLACE 103 101 WONG ZELAYA 103 102 FNAME LNAME EMPID DNO SALARY JAMES BORG 888665555 1 55000 JENNIFER WALLACE 987654321 4 43000 AHMAD JABBAR 987987987 4 25000 ALICIA ZELAYA 999887777 4 25000 JOHN SMITH 123456789 5 30000 FRANKLIN WONG 333445555 5 40000 JOYCE ENGLISH 453453453 5 25000 RAMESH NARAYAN 666884444 5 38000 Block 101 102 103 104
8
B+ Tree Index NARAYAN ENGLISH WALLACE BORG ENGLISH 101 104 JABBAR NARAYAN 102 104 SMITH WALLACE 103 101 WONG ZELAYA 103 102 FNAME LNAME EMPID DNO SALARY JAMES BORG 888665555 1 55000 JENNIFER WALLACE 987654321 4 43000 AHMAD JABBAR 987987987 4 25000 ALICIA ZELAYA 999887777 4 25000 JOHN SMITH 123456789 5 30000 FRANKLIN WONG 333445555 5 40000 JOYCE ENGLISH 453453453 5 25000 RAMESH NARAYAN 666884444 5 38000 Block 101 102 103 104
9
B* Tree Index NARAYAN 104 ENGLISH 104 WALLACE 101 BORG ENGLISH 101 104 JABBAR NARAYAN 102 104 SMITH WALLACE 103 101 WONG ZELAYA 103 102 FNAME LNAME EMPID DNO SALARY JAMES BORG 888665555 1 55000 JENNIFER WALLACE 987654321 4 43000 AHMAD JABBAR 987987987 4 25000 ALICIA ZELAYA 999887777 4 25000 JOHN SMITH 123456789 5 30000 FRANKLIN WONG 333445555 5 40000 JOYCE ENGLISH 453453453 5 25000 RAMESH NARAYAN 666884444 5 38000 Block 101 102 103 104
10
Some Definitions Block Size: Minimum Fixed sized unit that can be read or written on disk (in Bytes) Record Size: Size of a data record for a particular table. Add together field/column sizes (in Bytes) Blocking Factor: The number of data records than can fit in a data block (in Records per Block) Index Entry Size: The size of an index entry calculated as either (in Bytes): –(Primary, Clustering) The size of the indexed column + size of the block pointer –(Secondary) The size of the indexed column + size of the block pointer + the size of the record offset Fan Out: The number of index entries that can fit in a Block (in Index entries per block) Number of first level index entries:
11
Data Index R1 … R14 Block Size: 512 Bytes Record Size: 35 Bytes nRecords: 6200 bFactor: 512 / 35 = 14 rec/block nBlocks: 6200 / 14 = 443 blocks Index Entry Size: 19 Bytes Fan Out: 512 / 19 = 26 index entry/block First Index Level: 443 / 26 = 17.03846 = 18 Blocks Second Index Level: 18 / 26 = 1 Block Total Number of Levels: 2 Levels (check with Log 26 443) Total Size of Primary Index: (18 + 1) = 19 Blocks Block 1 R15 … R28 Block 2B3 … B4 … B26 … B27 … B52 …… B78 … B79 …R6200 B443 … B53 … I1 I2 I3 I4… I26 ……… I27 … I52I53 … I78I418 … I443 I1 I27 I53 … I418 … Example: Primary Index IB1IB2IB3IB17 1 st Level 2 nd Level
12
Data Index R1 … R14 Block Size: 512 Bytes Record Size: 35 Bytes nRecords: 6200 bFactor: 512 / 35 = 14 rec/block nBlocks: 6200 / 14 = 443 blocks Index Entry Size: 20 Bytes Fan Out: 512 / 20 = 25 index entry/block First Index Level: 6200 / 25 = 248 Blocks Second Index Level: 248 / 25 = 10 Blocks Third Index Level: 10 / 25 = 1 Block Total Size: 259 Blocks Total Number of Levels: 3 Levels (check with Log 25 6200) Block 1 R15 … R28 Block 2B3 … B4 … B26 … B27 … B52 …… B78 … B79 …R6200 B443 … B53 … I1 I2 I3 I4… I25 ……… I51 … I75I6176 … I6200 I1 I626 …. I5626 … Example: Secondary Index IB1IB2 IB3 IB248 I26 … I50 I1 I26 I51 … I625 IB249 I626 … I1250 IB250 I5626 … I6176 IB258 IB259 1 st Level 2 nd Level 3nd Level
13
R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 Data Block 1 R15 R16 R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 R27 R28 Data Block 2 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 I11 I12 I13 I14 I15 I16 I17 I18 I19 I20 I21 I22 I23 I24 I25 I1 I626 I1251 I1876 I2501 I3126 I3751 I4376 I5001 I5626 I6251 Example: Secondary Index – Close Up View IB1IB2 I1 I26 I51 I76 …. I526 I551 I576 I601 IB249 IB259 I26 I27 I28 I29 I30 I31 I32 I33 I34 … I626 I651 I676 I701 I726 …. I1176 I1201 I1226 IB250
14
FNAME LNAME SSN DNO SALARY JAMES BORG 888665555 1 55000 JOYCE ENGLISH 453453453 5 25000 AHMAD JABBAR 987987987 4 25000 RAMESH NARAYAN 666884444 5 38000 JOHN SMITH 123456789 5 30000 JENNIFER WALLACE 987654321 4 43000 FRANKLIN WONG 333445555 5 40000 ALICIA ZELAYA 999887777 4 25000 Block b1 b2 b3 b4 Ordered File
15
FNAME LNAME SSN DNO SALARY RAMESH NARAYAN 666884444 5 38000 ALICIA ZELAYA 999887777 4 25000 JAMES BORG 888665555 1 55000 JOHN SMITH 123456789 5 30000 JENNIFER WALLACE 987654321 4 43000 FRANKLIN WONG 333445555 5 40000 AHMAD JABBAR 987987987 4 25000 JOYCE ENGLISH 453453453 5 25000 Block b1 b2 b3 b4 Unordered File
16
FNAME LNAME SSN DNO SALARY RAMESH NARAYAN 666884444 5 38000 ALICIA ZELAYA 999887777 4 25000 JAMES BORG 888665555 1 55000 JOHN SMITH 123456789 5 30000 JENNIFER WALLACE 987654321 4 43000 FRANKLIN WONG 333445555 5 40000 AHMAD JABBAR 987987987 4 25000 JOYCE ENGLISH 453453453 5 25000 Block b1 b2 b3 b4 Indexed File I-Value Block BORG b2 ENGLISH b4 JABBAR b4 NARAYAN b1 SMITH b2 WALLACE b3 WONG b3 ZELAYA b1 Index Record Pointer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.