Scan index records to locate data record "P" while counting "processing steps" (h+v) -------- Linked List -------- | ------ Balanced B-Tree ------ 15 A-B | (textbook case) 14 B-C 13 C-D 12 D-E 11 E-F 10 F-G 9 G-H 8 H-I 7 I-J 6 J-K 5 K-L 4 L-M | A---------------I <-+ 3 M-N | A-------E I-------M <-+ 2 N-O | A---C E---G I---K M---O <-+ 1 O-P | A-B C-D E-F G-H I-J K-L M-N O-P <-+- index records 0 A B C D E F G H I J K L M N O P | A B C D E F G H I J K L M N O P <--- data records 45 steps to fetch "P" | 12 steps to fetch "P" +---------------------------------+-------------------------------- ---- OpenVMS Example #1 ---- | ---- OpenVMS Example #2 ---- (4 entries per index node) (2 entries per index node) (emphasis flatter) (emphasis smaller) 3 | H---------------P <-+ 2 | D-------H L-------P <-+ 1 D-------H-------L-------P | B---D F---H J---L N---P <-+- index records 0 A B C D E F G H I J K L M N O P | A B C D E F G H I J K L M N O P <--- data records 8 steps to fetch "P" | 10 steps to fetch "P" (4 in memory; 4 on disk) | (8 in memory; 2 on disk) +---------------------------------+--------------------------------- OpenVMS Example #1 Details: 0. we are searching for "P" so go to the root index at Level 1 1. is "P" <= "D"?; no so move on 2. is "P" <= "H"?; no so move on 3. is "P" <= "L"?; no so move on 4. is "P" <= "P"?; yes so drop to next level (disk in this case) 5. is "P" found in record "M"?; no so move on 6. is "P" found in record "N"?; no so move on 7. is "P" found in record "O"?; no so move on 8. is "P" found in record "P"?; yes so stop reference: http://h41379.www4.hpe.com/doc/73final/4506/4506pro_008.html#apps_rms_index_structure
Legend for the following examples:
<ur> = user response <sr> = system response <enter> = hit the enter key
<sr> $ <ur> dir troubledb2200.dat/nohead/notrail/size=all/width=file=45 ! see all file sizes before we start <sr> CSMIS$ROOT4:[DAT]TroubleDB2200.dat;120 250908/250911 ! 250908 blocks used; 250911 blocks allocated $ <ur> convert/create troubledb2200.dat *.* ! convert troubledb2200.dat into a newer version <sr> $ <ur> dir troubledb2200.dat/nohead/notrail/size=all/width=file=45 ! see the file sizes after we're done <sr> CSMIS$ROOT4:[DAT]TroubleDB2200.dat;121 250920/250920 ! slightly more blocks used / allocated CSMIS$ROOT4:[DAT]TroubleDB2200.dat;120 250908/250911 ! $
<sr> $ <ur> ana/rms/fdl TroubleDB2200.dat ! create an FDL for this file <sr> $ ! <ur> convert/create.fdl=troubledb2200.fdl troubledb2200.dat *.* ! convert troubledb2200.dat into a newer version <sr> $ <ur> dir troubledb2200.dat/nohead/notrail/size=all/width=file=45 ! see the file sizes after we're done <sr> CSMIS$ROOT4:[DAT]TroubleDB2200.dat;122 250920/250920 ! no change from version 121 CSMIS$ROOT4:[DAT]TroubleDB2200.dat;121 250920/250920 ! CSMIS$ROOT4:[DAT]TroubleDB2200.dat;120 250908/250911 ! $ <ur> type troubledb2200.fdl ! hacker's delight: peek into the FDL but do not change anything
<ur> $ana/rms/fdl TroubleDB2200.dat ! create an FDL for this file
<sr> $ !
<ur> sh sym edit ! Is EDIT redefined by a DCL symbol?
<sr> ED*IT == "EDIT/EDT" ! Yes. Notice "two equals" so we need to delete a global symbol
$
<ur> del/sym/glo edit ! delete global DCL symbol for current process
<sr> $ !
<ur> edit/fdl TroubleDB2200 ! invoke the FDL editor (notice that I did not enter an extension)
! continued in next yellow block...
========== Start Of Recorded Procedure ==========
Parsing Definition File Definition Parse Complete OpenVMS FDL Editor (menu) Add to insert one line into the FDL definition Delete to remove one line from the FDL definition Exit to leave the FDL Editor after creating the FDL file Help to obtain information about the FDL Editor Invoke to initiate a script of related questions Modify to change an existing line in the FDL definition Quit to abort the FDL Editor with no FDL file creation Set to specify FDL Editor characteristics View to display the current FDL Definition Main Editor Function (Keyword)[Help] : i <enter> Script Title Selection (menu) Add_Key modeling and addition of a new index's parameters Delete_Key removal of the highest index's parameters Indexed modeling of parameters for an entire Indexed file Optimize tuning of all indices' parameters using file statistics Relative selection of parameters for a Relative file Sequential selection of parameters for a Sequential file Touchup remodeling of parameters for a particular index Editing Script Title (Keyword)[-] : o <enter> An Input Analysis File is necessary for Optimizing Keys. Analysis File file-spec (1-512 chars)[null] : troubledb2200 <enter> (notice that I did not enter a file extension) Parsing Analysis File Analysis Parse Complete The Definition of Key 0 will be replaced. Press RETURN to continue (^Z for Main Menu) <enter> Key 0 Graph Type Selection Line Bucket Size vs Index Depth as a 2 dimensional plot Fill Bucket Size vs Load Fill Percent vs Index Depth Key Bucket Size vs Key Length vs Index Depth Record Bucket Size vs Record Size vs Index Depth Init Bucket Size vs Initial Load Record Count vs Index Depth Add Bucket Size vs Additional Record Count vs Index Depth Graph type to display (Keyword)[Line] : <enter> Number of Records that will be Reloaded into the File (0-2Giga)[203843] : <enter> (Fast_Convert NoFast_Convert RMS_Puts) File Reloading Method (Keyword)[Fast] : <enter> Number of Additional Records to be Added After the Reloading the File (0-2147279802)[0] : <enter> (input the record number you will add before next convert) Key 0 Segmentation desired (Yes/No)[No] : yes <enter> Note: you should always answer yes Key 0 Length SEG1 (1-255)[-] : 0 <enter> (asking about SEG1 because SEG0 was skipped; Note: this means key#0 was not segmented and lying did not break anything) *| 9| 8| Index 7| 6| Depth 5| 4| 3| 3 3 3 2| 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1| +- + - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - + 1 5 10 15 20 25 30 32 Bucket Size (number of blocks) PV-Prolog Version 3 KT-Key 0 Type String EM-Emphasis Flatter ( 9) DK-Dup Key 0 Values Yes KL-Key 0 Length 9 KP-Key 0 Position 0 RC-Data Record Comp 60% KC-Data Key Comp 27% IC-Index Record Comp 25% BF-Bucket Fill 100% RF-Record Format Variable RS-Mean Record Size 1200 LM-Load Method Fast_Conv IL-Initial Load 203843 AR-Added Records 0 Which File Parameter (Mnemonic)[refresh] : fd <enter> Text for FDL Title Section (1-126 chars)[null] :<enter> Emphasis Used In Defining Default: ( Flatter_files ) Suggested Bucket Sizes: ( 3 9 18 ) Number of Levels in Index: ( 3 2 2 ) Number of Buckets in Index: ( 593 66 18 ) Pages Required to Cache Index: ( 1779 594 324 ) Processing Used to Search Index: ( 288 588 1178 ) <<< ATTENTION Key 0 Bucket Size (3-63)[9] :<enter> +-------------------------------------------------------------------------------------------------- | Quote: The primary index structure consists of the file's data records and a key pathway based | on the primary key (key 0). The base of a primary index structure is the data records themselves, | arranged sequentially according to the primary key value. The data records are called level 0 of | the index structure. | | Reference: http://h41379.www4.hpe.com/doc/73final/4506/4506pro_008.html#apps_rms_index_structure | Interpretation: choosing a lower value here requires more memory but will reduce disk i/o +-------------------------------------------------------------------------------------------------- The Depth of Key 0 is Estimated to be No Greater than 2 Index levels, which is 3 Total levels. Press RETURN to continue (^Z for Main Menu) <enter> The Definition of Key 1 will be replaced. Press RETURN to continue (^Z for Main Menu) <enter> Key 1 Graph Type Selection Line Bucket Size vs Index Depth as a 2 dimensional plot Fill Bucket Size vs Load Fill Percent vs Index Depth Key Bucket Size vs Key Length vs Index Depth Graph type to display (Keyword)[Line] : <enter> Key 1 Segmentation desired (Yes/No)[No] : yes <enter> Note: you should always answer yes Key 1 Length SEG2 (1-255)[-] : 0 <enter> (asks about SEG2 because SEG0 and SEG1 were skipped; Note: apparently this key was segmented) *| 9| 8| Index 7| 6| Depth 5| 4| 3| 2| 2 2 2 2 2 2 2 2 2 2 2 1| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +- + - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - + 1 5 10 15 20 25 30 32 Bucket Size (number of blocks) PV-Prolog Version 3 KT-Key 1 Type String EM-Emphasis Flatter (18) DK-Dup Key 1 Values Yes KL-Key 1 Length 8 KP-Key 1 Position 95 RC-Data Record Comp 0% KC-Data Key Comp 60% IC-Index Record Comp 20% BF-Bucket Fill 100% RF-Record Format Variable RS-Mean Record Size 1200 LM-Load Method Fast_Conv IL-Initial Load 203812 AR-Added Records 0 Which File Parameter (Mnemonic)[refresh] : fd <enter> Emphasis Used In Defining Default: ( Flatter_files ) Suggested Bucket Sizes: ( 3 18 27 ) Number of Levels in Index: ( 2 1 1 ) Number of Buckets in Index: ( 21 1 1 ) Pages Required to Cache Index: ( 63 18 27 ) Processing Used to Search Index: ( 192 589 885 ) Key 1 Bucket Size (1-63)[18] : <enter> The Depth of Key 1 is Estimated to be No Greater than 1 Index levels, which is 2 Total levels. Press RETURN to continue (^Z for Main Menu) <enter> The Definition of Key 2 will be replaced. Press RETURN to continue (^Z for Main Menu) <enter> Key 2 Graph Type Selection Line Bucket Size vs Index Depth as a 2 dimensional plot Fill Bucket Size vs Load Fill Percent vs Index Depth Key Bucket Size vs Key Length vs Index Depth Graph type to display (Keyword)[Line] : <enter> Key 2 Segmentation desired (Yes/No)[No] : yes <enter> Note: you should always answer yes Key 2 Length SEG2 (1-255)[-] : 0 <enter> (asks about SEG2 because SEG0 and SEG1 were skipped; Note: apparently this key was segmented) *| 9| 8| Index 7| 6| Depth 5| 4| 3| 2| 2 2 2 2 2 2 2 2 2 2 2 1| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +- + - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - + 1 5 10 15 20 25 30 32 Bucket Size (number of blocks) PV-Prolog Version 3 KT-Key 2 Type String EM-Emphasis Flatter (18) DK-Dup Key 2 Values Yes KL-Key 2 Length 8 KP-Key 2 Position 99 RC-Data Record Comp 0% KC-Data Key Comp 60% IC-Index Record Comp 20% BF-Bucket Fill 100% RF-Record Format Variable RS-Mean Record Size 1200 LM-Load Method Fast_Conv IL-Initial Load 203814 AR-Added Records 0 Which File Parameter (Mnemonic)[refresh] : fd <enter> Emphasis Used In Defining Default: ( Flatter_files ) Suggested Bucket Sizes: ( 3 18 27 ) Number of Levels in Index: ( 2 1 1 ) Number of Buckets in Index: ( 21 1 1 ) Pages Required to Cache Index: ( 63 18 27 ) Processing Used to Search Index: ( 192 589 885 ) Key 2 Bucket Size (1-63)[18] : <enter> The Depth of Key 2 is Estimated to be No Greater than 1 Index levels, which is 2 Total levels. Press RETURN to continue (^Z for Main Menu) <enter> The Definition of Key 3 will be replaced. Press RETURN to continue (^Z for Main Menu) Key 3 Graph Type Selection Line Bucket Size vs Index Depth as a 2 dimensional plot Fill Bucket Size vs Load Fill Percent vs Index Depth Key Bucket Size vs Key Length vs Index Depth Graph type to display (Keyword)[Line] : <enter> Key 3 Segmentation desired (Yes/No)[No] : yes <enter> Note: you should always answer yes Key 3 Length SEG1 (1-255)[-] : 0 <enter> (asks about SEG1 because SEG0 was skipped; Note: this means key#3 was not segmented and lying did not break anything) *| 9| 8| Index 7| 6| Depth 5| 4| 3| 2| 2 2 2 2 2 2 2 2 2 2 1| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +- + - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - + 1 5 10 15 20 25 30 32 Bucket Size (number of blocks) PV-Prolog Version 3 KT-Key 3 Type String EM-Emphasis Flatter (18) DK-Dup Key 3 Values Yes KL-Key 3 Length 15 KP-Key 3 Position 304 RC-Data Record Comp 0% KC-Data Key Comp 58% IC-Index Record Comp 31% BF-Bucket Fill 100% RF-Record Format Variable RS-Mean Record Size 1200 LM-Load Method Fast_Conv IL-Initial Load 110857 AR-Added Records 0 Which File Parameter (Mnemonic)[refresh] : fd <enter> Emphasis Used In Defining Default: ( Flatter_files ) Suggested Bucket Sizes: ( 3 18 27 ) Number of Levels in Index: ( 2 1 1 ) Number of Buckets in Index: ( 19 1 1 ) Pages Required to Cache Index: ( 57 18 27 ) Processing Used to Search Index: ( 148 450 676 ) Key 3 Bucket Size (1-63)[18] : <enter> The Depth of Key 3 is Estimated to be No Greater than 1 Index levels, which is 2 Total levels. Press RETURN to continue (^Z for Main Menu) <enter> The Definition of Key 4 will be replaced. Press RETURN to continue (^Z for Main Menu) <enter> Key 4 Graph Type Selection Line Bucket Size vs Index Depth as a 2 dimensional plot Fill Bucket Size vs Load Fill Percent vs Index Depth Key Bucket Size vs Key Length vs Index Depth Graph type to display (Keyword)[Line] : <enter> Key 4 Segmentation desired (Yes/No)[No] : yes <enter> Note: you should always answer yes Key 4 Length SEG1 (1-255)[-] : 0 <enter> (asks about SEG1 because SEG0 was skipped) *| 9| 8| Index 7| 6| Depth 5| 4| 3| 2| 1| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +- + - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - + 1 5 10 15 20 25 30 32 Bucket Size (number of blocks) PV-Prolog Version 3 KT-Key 4 Type String EM-Emphasis Flatter ( 3) DK-Dup Key 4 Values Yes KL-Key 4 Length 8 KP-Key 4 Position 265 RC-Data Record Comp 0% KC-Data Key Comp 43% IC-Index Record Comp 37% BF-Bucket Fill 100% RF-Record Format Variable RS-Mean Record Size 1200 LM-Load Method Fast_Conv IL-Initial Load 1307 AR-Added Records 0 Which File Parameter (Mnemonic)[refresh] : fd <enter> Emphasis Used In Defining Default: ( Flatter_files ) Suggested Bucket Sizes: ( 3 3 18 ) Number of Levels in Index: ( 1 1 1 ) Number of Buckets in Index: ( 1 1 1 ) Pages Required to Cache Index: ( 3 3 18 ) Processing Used to Search Index: ( 115 115 696 ) Key 4 Bucket Size (1-63)[3] : <enter> The Depth of Key 4 is Estimated to be No Greater than 1 Index levels, which is 2 Total levels. Press RETURN to continue (^Z for Main Menu) <enter>
OpenVMS FDL Editor (menu) Add to insert one line into the FDL definition Delete to remove one line from the FDL definition Exit to leave the FDL Editor after creating the FDL file Help to obtain information about the FDL Editor Invoke to initiate a script of related questions Modify to change an existing line in the FDL definition Quit to abort the FDL Editor with no FDL file creation Set to specify FDL Editor characteristics View to display the current FDL Definition Main Editor Function (Keyword)[Help] : exit <enter>
========== End of Recorded Procedure ==========
<sr> CSMIS$ROOT4:[DAT]TroubleDB2200.FDL;2 123 lines $ <ur> convert/create/fdl=TroubleDB2200 TroubleDB2200.dat *.* <sr> $ <ur> dir troubledb2200.dat/nohead/notrail/size=all/width=file=40 <sr> CSMIS$ROOT4:[DAT]TroubleDB2200.dat;123 273690/273690 ! more blocks used / allocated but will be much faster CSMIS$ROOT4:[DAT]TroubleDB2200.dat;122 250920/250920 CSMIS$ROOT4:[DAT]TroubleDB2200.dat;121 250920/250920 CSMIS$ROOT4:[DAT]TroubleDB2200.dat;120 250908/250911 $