home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / apps / powerbase / Docs / Indices < prev    next >
Encoding:
Text File  |  1994-10-01  |  6.0 KB  |  112 lines

  1.                                 Indices
  2.                                 =======
  3.  
  4. The record data is stored in a file called ‘Database’ which is inside the
  5. database’s application directory. The order of records within ‘Database’ is
  6. determined purely by the order in which the records are entered. In order to
  7. access the records in a logical order we need one or more INDICES. Powerbase
  8. contains no sorting facilities (other than the ability to sort a validation
  9. table or, under special circumstances, a report) all ordering of data being
  10. achieved by the use of indices.
  11.  
  12. The most important index is index #0. This is always called ‘PrimaryKey’ and
  13. is created as part of the process of setting up a database (see ‘Create’).
  14. You will find the file ‘PrimaryKey’ inside the database directory. 
  15.  
  16. Other, subsidiary, indices may be created as and when required up to a
  17. maximum of 10. (This number will be found in the text file ‘Config’, in the
  18. ‘Resources’ subdirectory inside the Powerbase directory. It may be increased
  19. if necessary.) All indices except ‘PrimaryKey’ are stored in the
  20. subdirectory ‘Indices’ and all have an icon bearing an ‘I’. When a database
  21. is opened any indices in this subdirectory will be loaded automatically
  22. (indices operate in memory, for speed, not directly from disc.) Changes to
  23. the database cause the indices to be updated and closing the database (or
  24. quitting Powerbase itself) causes the updated indices to be written back to
  25. the disc.
  26.  
  27. Note that the more indices you use the longer it will take to add and delete
  28. records or to make alterations to records which involve changing several
  29. indices. The ideal situation would be to have ALL fields indexed and, given
  30. an ARM3-based machine and a record structure which hasn’t very many fields,
  31. this might well be feasible. Remember, however, that fields which are very
  32. repetitive (i.e. those which have only a few distinct values, these being
  33. repeated throughout many records) do not index efficiently. 
  34.  
  35. The file ‘!Tutorial’ gives simple examples showing how keys and indices
  36. work.
  37.  
  38. Indexing a field 
  39. ================ 
  40. Click MENU over the required field and follow the ‘Index field’ choice from
  41. the ‘Field’ sub-menu. The tag of the field you clicked on will appear in the
  42. first ‘Key field(s)’ icon. If you wish to use a composite key (see ‘Create’)
  43. you can use the “bump” icons to bring the tag of the second required field
  44. into view. Alternatively, the field may be selected from a menu. Choose
  45. whether or not you want to disregard word boundaries and enter either the
  46. key length or the numbers of characters from words 1-4 to be used in
  47. constructing the key (see ‘Create’). Select the ‘Case sensitive’ switch if
  48. required (see file ‘Create’) and click on ‘OK’. If the field is already
  49. indexed you will be warned of this and asked if you wish to overwrite the
  50. existing index. When indexing is complete you will see that the descriptor
  51. of the indexed field has changed from black to dark blue. 
  52.  
  53. Clicking on the “key” buttons on the keypad causes the red highlighting
  54. which indicates the current key to move from one indexed field to another.
  55. When you have a secondary key selected as the current key it works just like
  56. the primary key as regards browsing, searching and printing.
  57.  
  58. There is nothing to stop you indexing one field whilst a secondary index
  59. based on another field is the currently-active one, thus producing the
  60. effect of a “sort within a sort”. You should NOT however try to index a
  61. field when the currently-active index is on that same field!
  62.  
  63. Using an index to speed up printing
  64. ===================================
  65. The time taken to generate a report can sometimes be shortened dramatically
  66. by the use of a subsidiary. Selecting the ‘Use index’ button on the ‘Match’
  67. window will use an index to find the matching records IF the search formula
  68. contains a simple test for equality on an indexed field. 
  69.  
  70. Suppose, for instance, you are preparing a list of all transition elements
  71. from the ‘Elements’ sample database. The search formula would be GP=T.
  72. Without the use of an index such a list (with just the name of the element
  73. selected) will take about 6.5 seconds on a hard disc. If you create an index
  74. on the GP field and then select ‘Use index’ before clicking on ‘OK’ the same
  75. list takes only about 2.5 seconds.
  76.  
  77. Note that the search formula may be much more complex than in the above
  78. example as long as it contains at least one search element of the form
  79. TAG=VALUE where TAG is an indexed field. The index involved need not be the
  80. currently selected one.
  81.  
  82. Automatic saving of indices
  83. ===========================
  84. The loss of an index can be a serious matter, especially if it is the
  85. primary key index. As mentioned above an open database stores its indices in
  86. memory and normally writes them back to the disc only when it is closed. It
  87. would be most unfortunate if, after a long working session, the power were
  88. to fail or some kind person reset your computer for you or switched it off
  89. altogether. You are advised, therefore, to save the indices from time to
  90. time during a working session, just as you would (presumably!) save a long
  91. wordprocessor document at intervals. The ‘Force update’ button on the keypad
  92. causes all indices (and all validation tables, as a matter of fact) to be
  93. saved to disc. If you don’t want to have to bother remembering to do this
  94. you can automate the process as follows.
  95.  
  96. Find the ‘Save indices’ entry on the ‘Miscellaneous’ sub-menu. It leads in
  97. turn to another sub-menu with three choices:-
  98.  
  99.         (1) Automatic   Indices will be saved automatically at intervals
  100.                         specified by you. The default is 10 minutes.
  101.  
  102.         (2) Warning     The ‘Force update’ button will flash briefly,
  103.                         accompanied by a discreet beep, at intervals
  104.                         determined by you. No saving is performed and you
  105.                         may ignore the warning if you wish or click on
  106.                         ‘Force update’.
  107.  
  108.         (3) Manual      The user saves the indices as desired by clicking on
  109.                         ‘Force update’. This is the default setting.
  110.  
  111.  
  112.