Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
tips:revmedia:v2i1a3 [2023/11/14 17:09] – [!Filename] bshumsky | tips:revmedia:v2i1a3 [2024/06/19 20:20] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== !File Records===== | ||
+ | ^Published By^Date^Version^Knowledge Level^Keywords^ | ||
+ | |Sprezzatura Ltd|01 MAY 1990|1.15+|EXPERT|INDEX, | ||
+ | |||
+ | One of the most efficient forms of indexed access to a file is via BTREES | ||
+ | (Balanced Trees). This is a form of indexing where searching is performed | ||
+ | using a binary chop technique to retrieve the required keys in the minimum | ||
+ | possible time. It would seem reasonable to assume that all readers of this | ||
+ | journal are familiar (at least in theory) with the mechanisms of BTREE | ||
+ | (Balanced Tree) indexes. If not, a very good introductory text is | ||
+ | " | ||
+ | structure and quite unorthodox in implementation. Within the AREV Btree | ||
+ | nodes, lateral links exist in fields 2 and 3 to permit rapid traversing of | ||
+ | the index. This is an improvement to the standard structure. The | ||
+ | implementation seeks to address the problems encountered with speed when | ||
+ | rebalancing a Btree in real time. | ||
+ | |||
+ | When a record is filed and changes need to be made to an index, rebalancing | ||
+ | the index there and then can have a very adverse affect upon system | ||
+ | performance. To avoid this problem, AREV does not attempt to balance an | ||
+ | index when it saves a record, but rather writes a record to the transaction | ||
+ | file (!INDEXING) indicating which record in which file on which volume has | ||
+ | been changed and which changes are necessary to which indexes. These | ||
+ | transaction records (sequentially numbered with record 0 containing the | ||
+ | number of the highest transaction record used thus far) remain in the | ||
+ | !INDEXING file until an explicit " | ||
+ | workstation is left idle (and the " | ||
+ | |||
+ | When this happens the system takes the index transaction records one at a | ||
+ | time and creates new transaction records in the appropriate !datafiles. | ||
+ | These new transaction records are index specific and are keyed on the index | ||
+ | name followed by an * followed by the transaction record number (EG | ||
+ | SURNAME*2 - SURNAME* would contain the number of the next transaction record | ||
+ | to use). Once all !INDEXING records are distributed to the !datafiles, they | ||
+ | are applied to the indexes and the trees balanced. | ||
+ | |||
+ | Records in a !datafile thus have three classes of structure, control | ||
+ | records, transaction records and data records. The control records describe | ||
+ | the individual index characteristics. When indexes are added to or deleted | ||
+ | from a file, these records are modified accordingly. (Hence the " | ||
+ | Index Control Records" | ||
+ | the system is creating the appropriate records in the bang file). When the | ||
+ | file is accessed for the first time after these modifications have been | ||
+ | made, SI.MFS detects this fact and using these control records compiles the | ||
+ | index transaction code in !. (Should you be working on a low memory system, | ||
+ | "Out of String Space" can frequently occur at this point. To minimise memory | ||
+ | overhead, try using ED (v16 - REVMEDIA passim) to edit a record. Before | ||
+ | editing can proceed the index will be recompiled and as ED takes so little | ||
+ | memory there will be more chance of success.) | ||
+ | |||
+ | ==== General Notes ==== | ||
+ | |||
+ | The structures described in the following records seem to contain | ||
+ | significant amounts of redundancy, some of which may be necessary, others of | ||
+ | which may simply be historical artefacts. The notes following set out the | ||
+ | structure of the remaining control records. | ||
+ | |||
+ | ==== ! ==== | ||
+ | |||
+ | The bang record contains the compiled code called by SI.MFS as it performs | ||
+ | write operations to the file. Note that this code is processed by RTP5 as a | ||
+ | dictionary item and thus has similar structure. (For details on modifying | ||
+ | this record and subsequent recompilation see the 1.1 Addendum or the Version | ||
+ | 2 manuals). | ||
+ | |||
+ | ==== !! ==== | ||
+ | |||
+ | The bang bang record does not normally exist in the file, however if you add | ||
+ | it using the editor (EDIT !filename !! then F9), the next time index code is | ||
+ | recompiled, the source code will be placed into this item. If the index has | ||
+ | already been compiled the easiest way to recompile it is to add a BTREE | ||
+ | index to any field (don't update it), EDIT the file (this will cause a | ||
+ | recompilation of the ! logic), remove the BTREE index and again EDIT the | ||
+ | file. The index will now have been compiled as per the original index | ||
+ | specification. This enables you to study the way in which the code works and | ||
+ | make any necessary modifications. This should only be undertaken as a last | ||
+ | resort. The optimum use for this is to identify how various system routines | ||
+ | such as INDEX.OPEN are used. | ||
+ | |||
+ | |||
+ | ==== *INDEXES ==== | ||
+ | |||
+ | The *INDEXES record consists of a single multivalued field. Each value in | ||
+ | the record describes an index maintained on this file. Note that it will not | ||
+ | contain values relating to relational indexes TO this file, only FROM this | ||
+ | file. The values are actually record keys of other records in the bang file | ||
+ | and will thus have one of three forms | ||
+ | |||
+ | |Field Name|Btree Index| | ||
+ | |Field Name.XREF|XREF index| | ||
+ | |File related to*Field related to*Sort Order|Relational index| | ||
+ | |||
+ | |||
+ | === Field Name/Field Name.XREF === | ||
+ | |||
+ | This record (EG CUSTOMER_NAME) has four fields. The field are structured as | ||
+ | follows | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | |||
+ | === File_related_to*Field_Related_to*Sort_order === | ||
+ | |||
+ | This record (EG CUSTOMERS*INVOICES*AR) has seven field. The fields are | ||
+ | structured as follows | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | |||
+ | ==== !Filename ==== | ||
+ | |||
+ | This record (EG !CUSTOMERS) has only one field. It is broken down into | ||
+ | subvalues with there being three more subvalues that there are indexes on | ||
+ | the file. The first three subvalues follow the same structure but the | ||
+ | following subvalues are non-homogenous with a different structure for | ||
+ | Btree/ | ||
+ | mark delimited. The first three subvalues are structured as follows | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | The following subvalues are structured as follows | ||
+ | |||
+ | === BTREE Index === | ||
+ | |||
+ | This subvalue has four text values | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | === XREF Index === | ||
+ | |||
+ | This subvalue has four text values | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | === Relational Index To === | ||
+ | |||
+ | This subvalue identifies a field in the current record that should be used to update a field in another file (EG this would be on the customer number in an invoices file). This record has seven text values. | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | === Relational Index From === | ||
+ | |||
+ | This subvalue identifies a field in the current record that is updated by a relational index in another file. (EG this would be on the invoice numbers in a customer file). This record has four text values. | ||
+ | |||
+ | ^Field Number^Contents^ | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | |||
+ | (Volume 2, Issue 1, Pages 4-7) |