Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPH0789335B2 - Inserting and referencing records in indexed sequential files - Google Patents
[go: Go Back, main page]

JPH0789335B2 - Inserting and referencing records in indexed sequential files - Google Patents

Inserting and referencing records in indexed sequential files

Info

Publication number
JPH0789335B2
JPH0789335B2 JP63160815A JP16081588A JPH0789335B2 JP H0789335 B2 JPH0789335 B2 JP H0789335B2 JP 63160815 A JP63160815 A JP 63160815A JP 16081588 A JP16081588 A JP 16081588A JP H0789335 B2 JPH0789335 B2 JP H0789335B2
Authority
JP
Japan
Prior art keywords
record
block
data
move
destination information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP63160815A
Other languages
Japanese (ja)
Other versions
JPH0212439A (en
Inventor
政彦 吉村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP63160815A priority Critical patent/JPH0789335B2/en
Publication of JPH0212439A publication Critical patent/JPH0212439A/en
Publication of JPH0789335B2 publication Critical patent/JPH0789335B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

【発明の詳細な説明】 [発明の目的] (産業上の利用分野) この発明は、索引付順編成ファイルに対してキー値によ
る乱アクセスで順に並んだレコードの途中に新たなレコ
ードを挿入する場合、更にはレコード挿入により移動し
たレコードを参照する場合に好適な索引付順編成ファイ
ルにおけるレコード挿入および参照方法に関する。
DETAILED DESCRIPTION OF THE INVENTION Object of the Invention (Industrial field of use) The present invention inserts a new record in the middle of a record arranged in order by random access by a key value to an indexed sequential file. In addition, the present invention relates to a record insertion and reference method in an indexed sequential file suitable for referring to a record moved by record insertion.

(従来の技術) 一般にディスクに格納される索引付順編成ファイルは、
第4図(a)に示すように、インデックス部11、転置部
(副キーの転置インデックス部)12、およびデータ部13
から成る。データ部13は幾つかのデータブロック14から
成り、各データブロック14は主キー値順(ここでは昇
順)に配置される幾つかのデータレコード15、および各
レコード15毎に用意されるレコード制御ブロック(図示
せず)を含む。データレコード15は主キー値(図では数
値)および副キー値(図では英小文字)を有する。レコ
ード制御ブロックは、対応レコード15のブロック内位置
およびそのレコード長を示す。
(Prior Art) Generally, an indexed sequential file stored on a disk is
As shown in FIG. 4A, an index part 11, a transposing part (transposing index part of the sub-key) 12, and a data part 13
Consists of. The data part 13 is composed of several data blocks 14, each data block 14 is composed of several data records 15 arranged in a primary key value order (here, in ascending order), and a record control block prepared for each record 15. (Not shown). The data record 15 has a primary key value (numerical value in the figure) and a secondary key value (lowercase letters in the figure). The record control block indicates the block position of the corresponding record 15 and its record length.

次に、転置部12は幾つかの転置ブロック16から成る。こ
の転置ブロック16は幾つかのデータレコードを副キー値
の順にアクセスするためのもので、副キー値をレコード
として持ち、データレコードへのインデックス値を併せ
持つ(図では副キー値だけが示されている)。
Next, the transposition unit 12 consists of several transposition blocks 16. This transposed block 16 is for accessing several data records in the order of the subkey values. It has the subkey value as a record and also has the index value to the data record (only the subkey value is shown in the figure. Exist).

またインデックス部11は、主キーのインデックス木を成
す幾つか(ここでは1つ)のインデックスブロック17お
よび副キーのインデックス木を成す幾つか(ここでは1
つ)のインデックスブロック18から成る。まずインデッ
クスブロック17は、1段下のブロック(ここではデータ
ブロック14)の中での最大の主キー値をレコードとして
持ち、そのブロックへのインデックス値を併せ持つ(図
では主キー値だけが示されている)。インデックスブロ
ック17における主キー値の並びはその値順(ここでは昇
順)となっている。次にインデックスブロック18は、1
段下のブロック(ここでは転置ブロック16)の中での最
大の副キー置をレコードとして持ち、そのブロックへの
インデックス値を併せ持つ(図では副キー値だけが示さ
れている)。インデックスブロック18における副キー値
の並びはその値順(ここでは昇順)となっている。
In addition, the index unit 11 includes some (here, one) index blocks 17 forming a primary key index tree and some (here, 1) forming subkey index trees.
3) index block 18. First, the index block 17 has as a record the maximum primary key value in the block one step below (here, the data block 14), and also has the index value to that block (only the primary key value is shown in the figure. ing). The primary key values in the index block 17 are arranged in the order of their values (here, ascending order). Next, the index block 18 is 1
It has the record of the maximum subkey position in the lower block (transposition block 16 in this case) and also has the index value to that block (only the subkey value is shown in the figure). The arrangement of the sub-key values in the index block 18 is the value order (here, ascending order).

ここで、第4図(a)に示した索引付順編成ファイル
に、第4図(b)に示すように主キー値が2、副キー値
がbの新たなデータレコード25をキー値による乱アクセ
スで挿入する場合の従来方法について説明する。この場
合、レコードの並びは主キー値の昇順となるようにしな
ければならないことから、レコード25の挿入位置は、第
4図(a)から明らかなように主キー値が0と4の2つ
のレコード15の間となる。しかし、主キー値が0と4の
2つのレコード15が格納されているデータブロック14内
の空きスペース19が、挿入レコード25の大きさより小さ
い場合には、そのデータブロック14内にレコード25を挿
入することはできない。この場合、第4図(b)に示す
ように新たなデータブロック24をディスク上に生成し、
同ブロック24に元のブロック14からほぼ半数のレコード
(ここでは主キー値が4のレコード15)を移動してブロ
ック14の空きスペースを拡張した後に(即ちブロック分
割を行った後に)、同ブロック14(主キー値が0のレコ
ード15が格納されているブロック)に目的レコード25を
挿入する。この際、ブロック14に挿入したレコード25の
副キー値bをもとに各副キーのインデックス木をルート
ブロック(ここではインデックスブロック18)から辿
り、その副キー値bのインデックス(のレコード)の追
加先となる転置部12内の転置ブロック16を探す。この副
キー置bは、第4図(a)の例では、インデックスブロ
ック18の中の最小の副キー値eより小さいため、この副
キー値eのインデックスを持つ転置ブロック16が、副キ
ー値bのインデックスの追加先として求められる。この
転置ブロック16には、副キー値eのインデックスの他
に、副キー値a,cのインデックスが存在する。ここで副
キー値bと副キー値a,c,eとの大小関係は、a<b<c
<eであることから、第4図(b)に示すように副キー
値c,eのインデックスが移動され、副キー値aと副キー
値cの間に副キー値bのインデックスが追加される。
Here, in the indexed sequential file shown in FIG. 4 (a), a new data record 25 having a primary key value of 2 and a secondary key value of b is shown in FIG. 4 (b) according to the key value. A conventional method in the case of random access insertion will be described. In this case, since the records must be arranged in ascending order of the primary key values, the insertion position of the record 25 has two primary key values of 0 and 4 as apparent from FIG. 4 (a). It's between record 15. However, if the free space 19 in the data block 14 in which the two records 15 with primary key values 0 and 4 are stored is smaller than the size of the insert record 25, the record 25 is inserted into the data block 14. You cannot do it. In this case, a new data block 24 is created on the disk as shown in FIG. 4 (b),
Almost half of the records (here, record 15 whose primary key value is 4) is moved to the same block 24 from the original block 14 to expand the empty space of the block 14 (that is, after performing block division), and then the same block The target record 25 is inserted into 14 (block storing the record 15 having a primary key value of 0). At this time, the index tree of each subkey is traced from the root block (here, the index block 18) based on the subkey value b of the record 25 inserted in the block 14, and the index (record) of that subkey value b The transposition block 16 in the transposition unit 12 to be the addition destination is searched for. In the example of FIG. 4 (a), since this sub-key position b is smaller than the minimum sub-key value e in the index block 18, the transposed block 16 having the index of this sub-key value e It is obtained as the addition destination of the index of b. In this transposed block 16, in addition to the index of the subkey value e, the indexes of the subkey values a and c exist. Here, the magnitude relationship between the sub-key value b and the sub-key values a, c, e is a <b <c
Since <e, the indexes of the subkey values c and e are moved as shown in FIG. 4 (b), and the index of the subkey value b is added between the subkey value a and the subkey value c. It

さて、上記のブロック分割の結果、主キー値が4、副キ
ー値がgのレコード15の位置が変化する。このため、転
置ブロック16におけるそのレコード15に対するインデッ
クスのポイント先を、第4図(a)において矢印P1で示
す位置から、第4図(b)において矢印P2で示す位置、
即ちそのレコード15の移動先(実際には移動後のレコー
ド15に対応するデータブロック24内レコード制御ブロッ
ク)に変更しなければならない。この変更のためには、
上記したレコード(挿入レコード)25の副キー値bのイ
ンデックスを追加する場合と同様に、各副キーのインデ
ックス木をルートブロック(ここではインデックスブロ
ック18)から辿り、変更すべきインデックスのレコード
を見付けるという操作が必要となる。しかし、この操作
には、多数のブロックを単位とするディスクアクセスが
必要となるため(一般に、ブロックがディスクアクセス
単位となる)、多大な処理時間を要していた。しかも、
上記の変更処理を行っても、対応するレコード(移動レ
コード)15が参照されない場合には、変更処理に要した
時間が無駄になってしまう。
As a result of the above block division, the position of the record 15 having the primary key value of 4 and the secondary key value of g changes. Therefore, the point point of the index for the record 15 in the transposed block 16 is changed from the position indicated by the arrow P1 in FIG. 4 (a) to the position indicated by the arrow P2 in FIG. 4 (b).
That is, the destination of the record 15 (actually, the record control block in the data block 24 corresponding to the record 15 after the movement) must be changed. For this change,
Similar to the case of adding the index of the sub key value b of the record (inserted record) 25 described above, the index tree of each sub key is traced from the root block (here, the index block 18) to find the record of the index to be changed. That operation is required. However, this operation requires a disk access in units of a large number of blocks (generally, a block becomes a unit of disk access), and thus requires a great deal of processing time. Moreover,
Even if the above change processing is performed, if the corresponding record (moving record) 15 is not referred to, the time required for the change processing is wasted.

(発明が解決しようとする課題) 上記したように従来は、索引付順編成ファイルに対する
データレコーダ挿入操作でブロック分割が発生し、以前
からデータブロックに格納されていたレコードの移動が
あると、副キーの転置インデックス部のそのレコード
(移動したデータレコード)に対するインデックスの値
を変更するために副キーのインデックス木をルートブロ
ックから辿る必要があり、多数のブロックのディスクア
クセスを要することから、処理速度が低下するという問
題があった。
(Problems to be Solved by the Invention) As described above, conventionally, when a block division occurs in a data recorder insertion operation for an indexed sequential file and a record previously stored in a data block is moved, Since the index tree of the alternate key needs to be traced from the root block in order to change the index value for that record (moved data record) in the transposed index part of the key, disk access for a large number of blocks is required. There was a problem that it decreased.

したがってこの発明の課題は、索引付順編成ファイルに
対するデータレコード挿入操作でブロック分割が発生
し、以前からデータブロックに格納されていたデータレ
コードの位置が変化して、副キーの転置インデックス部
内に存在するそのレコード(移動レコード)の副キー値
のインデックスのポイント先と一致しなくなった場合に
おける処理速度の低下の防止を図ることである。この発
明の他の課題は、レコード挿入に伴って移動したレコー
ド参照が効率的に行えるようにすることである。
Therefore, the problem of the present invention is that the block division occurs in the data record insertion operation for the indexed sequential file, the position of the data record previously stored in the data block changes, and it exists in the transposed index part of the alternate key. It is to prevent a decrease in processing speed when the sub-key value of the record (moving record) does not match the point destination of the index. Another object of the present invention is to make it possible to efficiently refer to a record moved along with the record insertion.

[発明の構成] (課題を解決するための手段) この発明は、索引付順編成ファイルの構成要素であるデ
ータブロックに格納されている各データレコード毎に用
意されるレコード制御ブロックに、同レコード制御ブロ
ックに対応するデータレコードが新たなデータレコード
の挿入に伴うブロック分割で新たなデータブロックに移
動した場合の移動先を示す移動先情報を設定するための
移動先情報フィールドを設け、データレコードを移動し
て新たなデータレコードを挿入した場合には、移動前レ
コードに対応するレコード制御ブロック内の移動先情報
フィールドに、同レコードの移動先を示す移動先情報を
設定し、レコード挿入に伴うブロック分割で移動したデ
ータレコードの副キー値と併せて副キーの転置インデッ
クス部内に設定されている同レコードへのインデックス
を探して変更する変更処理を省略するようにしたことを
特徴とする。この変更処理は、上記移動レコードを副キ
ー値による乱アクセスで参照した場合に、その参照のた
めに用いられたレコード制御ブロック内の移動先情報フ
ィールドの設定内容に基づいて行われる。
[Structure of the Invention] (Means for Solving the Problems) The present invention relates to a record control block prepared for each data record stored in a data block which is a constituent element of an indexed sequential file, in which the same record is stored. The data record corresponding to the control block is provided with a move destination information field for setting the move destination information indicating the move destination when the data record is moved to a new data block by block division accompanying the insertion of the new data record. When moving and inserting a new data record, move destination information indicating the move destination of the record is set in the move destination information field in the record control block corresponding to the record before movement, and the block accompanying the record insertion is set. It is set in the transposed index part of the alternate key along with the alternate key value of the data record that was moved by splitting. It is characterized in that so as to omit the change process of change looking for the index to the same record. This changing process is performed based on the setting content of the move destination information field in the record control block used for the reference when the move record is referred to by the irregular access by the sub-key value.

(作用) 上記の構成によれば、レコードの挿入に伴うブロック分
割でデータレコードの移動が発生した場合、その移動先
を示す情報が元のデータブロックの対応レコード制御ブ
ロックの移動先情報フィールドに設定されるので、副キ
ーの転置インデックス部内で上記移動したデータレコー
ドの副キー値と併せて設定されている同レコードへのイ
ンデックスを探して変更する変更処理を省略しても上記
移動したデータレコードを参照することが可能となる。
即ち、ブロック分割に伴うレコード移動時の転置インデ
ックス部の変更処理が省略できるので、この種の変更処
理に伴う処理速度の低下が防止できる。また、上記の変
更処理は、移動レコードを副キー値による乱アクセスで
実際に参照した場合に行われるので、ブロック分割に伴
うレコード移動時に無条件で変更処理を行っていた従来
方法に比べて無駄な変更処理がなくなる。
(Operation) According to the configuration described above, when a data record is moved due to block division accompanying record insertion, information indicating the destination is set in the destination information field of the corresponding record control block of the original data block. Therefore, even if you omit the modification process of searching for and changing the index to the same record that is set with the subkey value of the moved data record in the transposed index part of the subkey, It becomes possible to refer.
That is, it is possible to omit the processing of changing the transposed index portion when moving a record due to block division, and thus it is possible to prevent the processing speed from being lowered due to this kind of changing processing. In addition, the above-mentioned change processing is performed when the moved record is actually referred to by the irregular access by the alternate key value, so it is useless as compared with the conventional method in which the change processing is unconditionally performed when the record is moved due to block division. There is no need to change.

(実施例) 以下、この発明の一実施例を図面を参照して説明する。
なお、第4図と同一部分には同一符号を付して詳細な説
明を省略する。
Embodiment An embodiment of the present invention will be described below with reference to the drawings.
The same parts as those in FIG. 4 are designated by the same reference numerals and detailed description thereof will be omitted.

まず、図示せぬディスクに、第4図(a)に示した索引
付順編成ファイルと同一レコード構成の索引付順編成フ
ァイルが格納されているものとする。但し、この実施例
で用いられる索引付順編成ファイルの要素であるデータ
ブロックの構造(更に具体的に述べるならば、データブ
ロック内のレコード制御ブロックの構造)は、第4図
(a)に示した従来の索引付順編成ファイルのそれと異
なる。このデータブロックの構造(更にはレコード制御
ブロックの構造)について、第1図(a)を参照して説
明する。
First, it is assumed that a disc (not shown) stores an indexed sequential file having the same record structure as the indexed sequential file shown in FIG. 4 (a). However, the structure of the data block, which is the element of the indexed sequential file used in this embodiment (more specifically, the structure of the record control block in the data block) is shown in FIG. 4 (a). It differs from that of the conventional indexed sequential file. The structure of the data block (further, the structure of the record control block) will be described with reference to FIG.

第1図(a)において、14′は主キー値が0(副キー値
がi)と主キー値が4(副キー値がg)の2つのデータ
レコード15を持つデータブロック、31はブロック制御ブ
ロックである。ブロック制御ブロック31は、同ブロック
31が置かれるデータブロック(ここではデータブロック
14′)の空きスペース19の位置並びにサイズを示す情
報、およびデータブロックのみを参照して主キー値の順
にデータレコードをアクセスする場合のデータブロック
の繋がり(チエイン)を示す情報(即ち次のデータブロ
ック並びに前のデータブロックへのポインタ)等が設定
される。ブロック制御ブロック31には、対応データブロ
ックを識別するためのブロック識別子、例えばシーケン
シャルなブロック番号が設定されるブロック番号フィー
ルド32が設けられる。図では、フィールド32には値が10
のブロック番号が設定されている。
In FIG. 1 (a), 14 'is a data block having two data records 15 having a primary key value of 0 (subkey value is i) and a primary key value of 4 (subkey value is g), and 31 is a block. It is a control block. Block control block 31 is the same block
The data block in which 31 is placed (here, the data block
14 ') information indicating the position and size of the empty space 19 and information indicating the chain of data blocks when the data records are accessed in the order of the primary key value by referring to only the data block (that is, the next data). Blocks and pointers to previous data blocks) etc. are set. The block control block 31 is provided with a block identifier field for identifying a corresponding data block, for example, a block number field 32 in which a sequential block number is set. In the figure, field 32 has the value 10
Block number is set.

33は主キー値が0のレコード15(データブロック14′内
の先頭レコード)に対するレコード制御ブロック、34は
主キー値が4のレコード15(データブロック14′内の2
番目のレコード)に対するレコード制御ブロックであ
る。レコード制御ブロック34は、第1図(a)に示すよ
うに対応レコードのサイズ(レコード長)を示す情報を
設定するためのレコード長フィールド41、対応レコード
のデータブロック(ここではデータブロック14′)内位
置を示す情報を設定するためのブロック内位置情報フィ
ールド42、対応レコードが新たなデータレコードの挿入
に伴うブロック分割で新たなデータブロックに移動した
場合の移動先を示す移動先情報を設定するための移動先
情報フィールド43を含んでいる。レコード制御ブロック
33のフォーマットも上記のレコード制御ブロック34と同
様であり、したがって第1図(a)では省略してある。
33 is a record control block for the record 15 having the primary key value of 0 (the first record in the data block 14 '), and 34 is the record 15 having the primary key value of 4 (2 in the data block 14').
Record control block for the second record). The record control block 34, as shown in FIG. 1A, has a record length field 41 for setting information indicating the size (record length) of the corresponding record, the data block of the corresponding record (here, the data block 14 '). An in-block position information field 42 for setting information indicating an inner position, and move destination information indicating a move destination when a corresponding record is moved to a new data block by block division accompanying insertion of a new data record A destination information field 43 for Record control block
The format of 33 is the same as that of the record control block 34 described above, and is therefore omitted in FIG. 1 (a).

ブロック内位置情報フィールド42に設定される情報は、
対応データブロックのブロック番号(図では10)と対応
レコード制御ブロック(レコード制御ブロック34)のブ
ロック番号である。レコード制御ブロック34のブロック
番号は、対応レコードがデータブロック14′内で何番目
のレコードであるかによって決り、この例では2とな
る。この番号2は、対応レコード制御ブロック34がデー
タブロック14′において後から2番目のブロックである
ことも示す。なお、対応レコードが他のデータブロック
に移動した場合には、ブロック内位置情報フィールド42
には同フィールド42の内容が無効であることを示すNULL
値(ヌル値)が設定される。一方、移動先情報フィール
ド43に設定される情報は、対応レコードの移動先のデー
タブロックのブロック番号と対応レコード制御ブロック
のブロック番号である。なお、対応レコードが他のデー
タブロックに移動されない場合には、移動先情報フィー
ルド43には第1図(a)に示すように同フィールド43の
内容が無効であることを示すNULL値(ヌル値)が設定さ
れる。
The information set in the block position information field 42 is
The block number of the corresponding data block (10 in the figure) and the block number of the corresponding record control block (record control block 34). The block number of the record control block 34 is determined by the number of the corresponding record in the data block 14 ', and is 2 in this example. This number 2 also indicates that the corresponding record control block 34 is the second last block in the data block 14 '. If the corresponding record is moved to another data block, the block internal position information field 42
Is NULL indicating that the contents of field 42 is invalid.
A value (null value) is set. On the other hand, the information set in the destination information field 43 is the block number of the destination data block of the corresponding record and the block number of the corresponding record control block. When the corresponding record is not moved to another data block, the destination information field 43 has a null value (null value) indicating that the content of the same field 43 is invalid as shown in FIG. ) Is set.

さて、この実施例では、第1図(a)に示したデータブ
ロック14′を、第4図(a)に示す主キー値が0(副キ
ー値がi)と主キー値が4(副キー値がg)の2つのデ
ータレコード15を持つデータブロック14に代えて用いる
ようにしている。したがって、必要があれば第4図
(a)において、主キー値が0と4の2つのレコード15
を持つデータブロック14を、第1図(a)に示すデータ
ブロック14′に置換えて参照されたい。
In this embodiment, the data block 14 'shown in FIG. 1 (a) has the primary key value 0 (sub key value i) and the primary key value 4 (sub key) shown in FIG. 4 (a). It is used instead of the data block 14 having the two data records 15 with the key value g). Therefore, if necessary, two records with primary key values 0 and 4 in FIG.
Refer to by replacing the data block 14 with the data block 14 'shown in FIG. 1 (a).

ここで、第1図(a)において、主キー値が0と4の2
つのレコード15の間に、第1図(b)に示すように主キ
ー値が2、副キー値がbの新たなデータレコード25を挿
入する必要が発生したものとする。このとき、挿入レコ
ード25のサイズが上記2つのレコード15を持つデータブ
ロック14′の空きスペース19より大きいものとすると、
従来と同様にブロック分割が発生する。即ち、まず第1
図(b)に示すようにブロック番号11の新たなデータブ
ロック24′がディスク上に生成され、同ブロック24′に
元のブロック14′から主キー値が4のレコード15が移動
される。この際、データブロック24′には、移動レコー
ド15に対するレコード制御ブロック35が設定される。こ
のレコード制御ブロック35の内容は、第1図(a)に示
すレコード移動前(ブロック分割前)のレコード制御ブ
ロック34と、ブロック内位置情報フィールド42の内容を
除いて同一である。即ちレコード制御ブロック35のフィ
ールド42には、新たなデータブロック24′のブロック番
号11と、レコード制御ブロック35のブロック番号1とが
設定される。
Here, in FIG. 1A, the primary key values 0 and 4 are 2
It is assumed that it is necessary to insert a new data record 25 having a primary key value of 2 and a sub key value of b between two records 15 as shown in FIG. At this time, assuming that the size of the inserted record 25 is larger than the empty space 19 of the data block 14 'having the above two records 15,
Block division occurs as in the conventional case. That is, first
As shown in FIG. 9B, a new data block 24 'having a block number 11 is generated on the disk, and the record 15 having the primary key value of 4 is moved from the original block 14' to the block 24 '. At this time, the record control block 35 for the move record 15 is set in the data block 24 '. The contents of the record control block 35 are the same as those of the record control block 34 before record movement (before block division) shown in FIG. 1A except the contents of the in-block position information field 42. That is, in the field 42 of the record control block 35, the block number 11 of the new data block 24 'and the block number 1 of the record control block 35 are set.

一方、主キー値が4の移動レコード15に対する元のデー
タブロック14′内のレコード制御ブロック34について
は、そのままデータブロック14′に残される。そして、
上記残されたレコード制御ブロック34のブロック内位置
情報フィールド42には、第1図(b)に示すようにNULL
値が設定され、同ブロック34の移動先情報フィールド43
には主キー値が4のレコード15の移動先を示す移動先情
報(ここでは、移動先データブロック24′のブロック番
号11とレコード制御ブロック35のブロック番号1から成
る情報)が設定される。さて、上記のブロック分割に伴
うレコード移動でデータブロック14′の空きスペースが
拡張されると、その空きスペースを利用して第1図
(b)に示すように目的レコード25の挿入が行われ、且
つ同レコード25に対するレコード制御ブロック36が設定
される。
On the other hand, the record control block 34 in the original data block 14 'for the moving record 15 having the primary key value of 4 is left as it is in the data block 14'. And
In the block position information field 42 of the remaining record control block 34, as shown in FIG.
The value is set and the destination information field 43 of the same block 34 is set.
The destination information indicating the destination of the record 15 having the primary key value of 4 (here, the information including the block number 11 of the destination data block 24 'and the block number 1 of the record control block 35) is set. Now, when the empty space of the data block 14 'is expanded by the record movement accompanying the above block division, the target record 25 is inserted using the empty space as shown in FIG. 1 (b). And the record control block 36 for the same record 25 is set.

以上のデータレコード25挿入に伴う一連の処理終了後の
索引付順編成ファイルのデータ構造を第2図に示す。但
し、主キーのインデックス木(第4図ではインデックス
ブロック17)については本発明と直接関係しないため省
略してある。第2図において主キー値が8(幅キー値が
a)のデータレコード15を持つデータブロック14′は、
第4図(a),(b)に示す主キー値が8(副キー値が
a)のデータレコード15を持つデータブロック15に対応
し、第2図において主キー値が12と16(副キー値がcと
e)の2つのデータレコード15を持つデータブロック1
4′は、第4図(a),(b)に示す主キー値が12と16
(副キー値がcとe)の2つのデータレコード15を持つ
データブロック14に対応する。また、第2図において、
37,38,39はそれぞれ主キー値が8,12,16のレコード15に
対するレコード制御ブロックであり、そのフォーマット
は前記したレコード制御ブロック34と同一である。
FIG. 2 shows the data structure of the indexed sequential organization file after the series of processes following the insertion of the data record 25 described above. However, the index tree of the primary key (index block 17 in FIG. 4) is omitted because it is not directly related to the present invention. In FIG. 2, a data block 14 'having a data record 15 with a primary key value of 8 (width key value of a) is
It corresponds to a data block 15 having a data record 15 with a primary key value of 8 (subkey value a) shown in FIGS. 4 (a) and 4 (b), and in FIG. Data block 1 with two data records 15 with key values c and e)
4'has primary key values 12 and 16 shown in FIGS. 4 (a) and 4 (b).
It corresponds to a data block 14 having two data records 15 (with subkey values c and e). In addition, in FIG.
37, 38, 39 are record control blocks for the record 15 having primary key values of 8, 12, 16 respectively, and their formats are the same as those of the record control block 34 described above.

さて、この実施例では、データレコード25の挿入に伴う
一連の処理において、上記のようにブロック分割が発生
してレコードの移動が行われても、従来とは異なって、
転置ブロック16の内容変更、更に具体的に述べるならば
主キー値が4、副キー値がgの移動レコード15に対する
転置ブロック16内のインデックスのポイント先の変更を
行わないことに注意されたい。このため、第2図におけ
る転置ブロック16内の対応インデックスのポイント先
は、矢印P3で示すように、移動前の主キー値が4のレコ
ード15(に対するレコード制御ブロック34)を指してい
る。このポイント先の変更を行わなくても、以下に述べ
るようにレコード制御ブロック(ここではレコード制御
ブロック34)の移動先情報フィールド43の内容に従っ
て、移動レコード15を参照することは可能である。な
お、この実施例では、移動レコードの参照時に上記のポ
イント先の変更を行うようにしている。
Now, in this embodiment, in the series of processing accompanying the insertion of the data record 25, even if the block division occurs and the record is moved as described above, unlike the conventional case,
It should be noted that the contents of the transposition block 16 are not changed, more specifically, the index point in the transposition block 16 for the move record 15 having the primary key value of 4 and the sub key value of g is not changed. Therefore, the point of the corresponding index in the transposition block 16 in FIG. 2 points to the record 15 (with respect to the record control block 34) whose primary key value before movement is 4 as indicated by arrow P3. It is possible to refer to the move record 15 according to the contents of the move destination information field 43 of the record control block (here, the record control block 34) as described below without changing the point destination. In this embodiment, the point destination is changed when the moving record is referred to.

ここで、第2図に示す索引付順編成ファイルを対象とし
て副キーによる乱アクセスでデータレコードを参照する
場合の動作を、副キー値がgのレコード参照を例に第3
図のフローチャートを用いて説明する。まず、副キーの
インデックス木のルートブロック(第2図ではインデッ
クスブロック18)より、キー値(副キー値)に従って転
置部12の転置ブロック16内の該当インデックスを探す
(ステップS1)。転置部12のインデックスは、そのキー
値(副キー値)を持つデータレコード(に対するレコー
ド制御ブロック)の存在する位置をインデックス値とし
て持っているので、その値から目的レコードの存在する
データブロック(内の対応レコード制御ブロック)を参
照する(ステップS2)。したがって、副キー値がgであ
るこの例では、第2図から明らかなように矢印P3の示す
データブロック14′(内のレコード制御ブロック34)が
参照される。
Here, the operation of referring to the data record by the irregular access by the alternate key for the indexed sequential file shown in FIG. 2 will be described with reference to a record reference with the alternate key value g as an example.
This will be described with reference to the flowchart in the figure. First, the root block (index block 18 in FIG. 2) of the subkey index tree is searched for the corresponding index in the transposition block 16 of the transposition unit 12 according to the key value (subkey value) (step S1). The index of the transposing unit 12 has a position where a data record (record control block for) having the key value (subkey value) exists as an index value. Corresponding record control block) (step S2). Therefore, in this example in which the sub key value is g, the data block 14 '(the record control block 34 therein) indicated by the arrow P3 is referred to, as is apparent from FIG.

次に、上記参照したデータブロック14′内に目的レコー
ド(参照しようとする副キー値がgのレコード)が存在
するか、或は目的レコードがブロック分割に伴うレコー
ド移動が存在しなくなったかを、データブロック14′内
のレコード制御ブロック34のブロック内位置情報フィー
ルド42(第1図(b)参照)によって調べる(ステップ
S3)。もし、フィールド42にNULL値が設定されていなけ
れば、目的レコードは同フィールド42によって示される
同じデータブロック14′の位置から始まる領域(フィー
ルド41によって示されるレコード長の領域)に存在する
ことから、そのレコードを参照し(ステップS4)、レコ
ード参照処理を終える。
Next, it is determined whether the target record (the record whose sub-key value g is to be referenced) exists in the referenced data block 14 ', or whether the target record does not move due to block division. It is checked by the in-block position information field 42 (see FIG. 1 (b)) of the record control block 34 in the data block 14 '(step
S3). If the null value is not set in the field 42, the target record exists in the area starting from the position of the same data block 14 ′ indicated by the field 42 (the area of the record length indicated by the field 41). The record is referred to (step S4), and the record referencing process ends.

一方、本実施例のようにレコード制御ブロック34のフィ
ールド42にNULL値が設定されていれば、上記参照したデ
ータブロック14′には目的レコードが存在しないことか
ら、データブロック14′内のレコード制御ブロック34の
移動先情報フィールド43から第2図において矢印P4で示
される目的レコードの移動先(に対するレコード制御ブ
ロック35)の位置を調べ、そのデータブロック24′(内
の対応レコード制御ブロック35)を参照する(ステップ
S5)。次に、ステップS5で参照したデータブロック24′
内に目的レコードが存在するか、或は目的レコードがブ
ロック分割に伴うレコード移動で存在しなくなったか
を、データブロック24′内のレコード制御ブロック35の
ブロック内位置情報フィールド42(第1図(b)参照)
によって調べる(ステップS5)。このステップS5を実行
する理由は、ブロック分割によりデータブロック24′に
移動したレコードが、同ブロック24′に対する新たなレ
コード挿入のために更にブロック分割が発生し、再度他
のブロックへ移動している可能性があるからである。し
たがって、データブロック24′内に目的レコードが存在
しない場合には、ステップS5に戻って更に移動先のデー
タブロック(内のレコード制御ブロック)を参照する。
そして、このステップS5と、次のステップS6の判定処理
とを、目的レコードが存在するデータブロックを見つけ
るまで繰返す。
On the other hand, if the NULL value is set in the field 42 of the record control block 34 as in the present embodiment, the target record does not exist in the data block 14 'referred to above, so that the record control in the data block 14' is controlled. The position of the destination (record control block 35) of the target record indicated by arrow P4 in FIG. 2 is checked from the destination information field 43 of the block 34, and the data block 24 '(corresponding record control block 35 therein) Reference (step
S5). Next, the data block 24 'referred to in step S5
Whether or not the target record exists in the data block or the target record does not exist due to the record movement due to the block division, the in-block position information field 42 of the record control block 35 in the data block 24 '(Fig. 1 (b )reference)
(Step S5). The reason for executing this step S5 is that the record moved to the data block 24 'due to the block division is further divided into blocks due to the insertion of a new record in the block 24', and is moved to another block again. Because there is a possibility. Therefore, if the target record does not exist in the data block 24 ', the process returns to step S5 to further refer to the destination data block (the record control block therein).
Then, this step S5 and the determination process of the next step S6 are repeated until the data block in which the target record exists is found.

さて、この実施例では、1回目のステップS6の処理で、
データブロック24′内に目的レコード(副キー値がgの
レコード15)が存在することが検出される。この場合、
転置部12の転置インデックス16の副キー値gを持つイン
デックスが、目的レコード15が実際に存在する(データ
ブロック14′内の対応レコード制御ブロック35の)位置
を矢印P5に示す如く直接指すように、インデックスの値
を変更する(ステップS7)。この変更の後は、ステップ
S4に進んで目的レコード15を参照し、レコード参照処理
を終える。以降、この(副キー値がgの)レコード15に
対するレコード参照(副キー値gの乱アクセスによるレ
コード参照)は、転置部12内の対応するインデックスに
より同レコード15が実際に存在する位置が(第2図にお
ける矢印R5のように)指され、したがってインデックス
の値により参照したデータブロックの中に目的レコード
15は存在するので、第3図のフローチャートのステップ
S3からステップS4に分岐し、直ちに目的レコード15が参
照される。
Now, in this embodiment, in the processing of step S6 for the first time,
It is detected that a target record (record 15 having a subkey value g) is present in the data block 24 '. in this case,
The index having the sub-key value g of the transposed index 16 of the transposing unit 12 points directly to the position (of the corresponding record control block 35 in the data block 14 ') where the target record 15 actually exists, as shown by the arrow P5. , Change the index value (step S7). After this change,
The process proceeds to S4, the target record 15 is referred to, and the record reference process ends. After that, the record reference (record reference due to random access of the sub key value g) to this record 15 (the sub key value of which is g) is the position where the record 15 actually exists due to the corresponding index in the transposing unit 12. The target record in the data block pointed to (as indicated by arrow R5 in FIG. 2) and thus referenced by the value of the index.
Since 15 exists, the steps of the flowchart of FIG.
The process branches from S3 to step S4, and the target record 15 is immediately referenced.

以上はレコード挿入に伴ってブロック分割が起りレコー
ド移動が発生した場合について説明したがこれに限るも
のではない。即ち本発明は、例えば索引付順編成ファイ
ルのデータ更新(モディファイ)時にレコード長が元の
長さより長くなったためにデータブロック内にそのレコ
ードが収まらず、その結果ブロック分割が起きてレコー
ド移動が発生した場合にも応用可能であり、レコード移
動発生時の副キーのインデックス木の転置部の変更処理
を不要とすることができる。
The case where block division occurs due to record insertion and record movement occurs has been described above, but the present invention is not limited to this. That is, according to the present invention, for example, when the data of an indexed sequential file is updated (modify), the record length becomes longer than the original length, so that the record does not fit in the data block, and as a result, block division occurs and record movement occurs. It is also applicable to the above case, and the process of changing the transposed part of the index tree of the subkey when a record move occurs can be eliminated.

[発明の効果] 以上詳述したようにこの発明によれば、レコードの挿入
に伴うブロック分割でデータレコードの移動が発生した
場合、その移動先を示す情報が元のデータブロックの対
応レコード制御ブロックの移動先情報フィールドに設定
されるので、副キーの転置インデックス部内で上記移動
したデータレコードの副キー値と併せて設定されている
同レコードへのインデックスを探して変更する変更処理
を省略しても上記移動したデータレコードを参照するこ
とが可能となる。即ちこの発明によれば、ブロック分割
に伴うレコード移動時における転置インデックス部内で
の移動レコードの副キー値のインデックスの変更処理が
省略できるので、この種の変更処理に伴う処理速度の低
下が防止できる。但し、上記の変更処理を行わない状態
で移動レコードを副キー値による乱アクセスで参照しよ
うとすると、元のデータブロックを経由する間接アクセ
スとなるため、そのレコードを1回だけアクセスする場
合には問題とならないが、複数回参照することがある場
合には処理速度の低下を招く。しかしこの発明によれ
ば、上記の変更処理は移動レコードを副キー値による乱
アクセスで実際に参照した場合に行われるので、移動レ
コードに対する2回目以降の参照が高速に行え、しかも
参照されない移動レコードについては上記の変更処理は
行われないため、ブロック分割に伴うレコード移動時に
無条件で変更処理を行っていた従来方法に比べて無駄な
変更処理がなくなる。
[Effects of the Invention] As described in detail above, according to the present invention, when a data record is moved due to block division accompanying the insertion of a record, the information indicating the destination is the corresponding record control block of the original data block. Since it is set in the destination information field of, the omission of the change process of searching for and changing the index to the same record that is set with the subkey value of the moved data record in the transposed index part of the subkey Can also refer to the moved data record. That is, according to the present invention, the process of changing the index of the sub-key value of the moving record in the transposed index portion at the time of moving the record due to the block division can be omitted, so that it is possible to prevent a decrease in the processing speed due to this kind of changing process. . However, if an attempt is made to refer to a moving record by random access using a sub-key value without performing the above-mentioned change processing, it will be an indirect access via the original data block. Therefore, if that record is accessed only once, This is not a problem, but if it is referenced multiple times, the processing speed will be reduced. According to the present invention, however, the above-mentioned change processing is performed when the moving record is actually referred to by the irregular access by the sub-key value. Therefore, the second and subsequent references to the moving record can be performed at high speed, and the moving record that is not referred to can be used. Since the above-mentioned change processing is not performed, useless change processing is eliminated as compared with the conventional method in which the change processing is unconditionally performed at the time of moving records accompanying block division.

【図面の簡単な説明】[Brief description of drawings]

第1図乃至第3図はこの発明の一実施例を示すもので、
第1図はデータレコードの移動を伴う場合のレコード挿
入処理を説明するためのデータブロック状態遷移図、第
2図は上記レコード挿入処理後の索引付順編成ファイル
のデータ構造を抜出して示す図、第3図は副キー値の乱
アクセスによるデータレコード参照時の処理手順を示す
フローチャート、第4図はデータレコードの移動を伴う
場合の従来のレコード挿入処理を説明するための索引付
順編成ファイルのデータ構造状態遷移図である。 11……インデックス部、12……転置部(転置インデック
ス部)、13……データ部、14,14′,24,24′……データ
ブロック、15,25……レコード、16……転置ブロック、1
9……空きスペース、31,33〜39……レコード制御ブロッ
ク、42……ブロック内位置情報フィールド、43……移動
先情報フィールド。
1 to 3 show an embodiment of the present invention.
FIG. 1 is a data block state transition diagram for explaining a record insertion process when a data record is moved, and FIG. 2 is a diagram showing an extracted data structure of an indexed sequential file after the record insertion process, FIG. 3 is a flowchart showing a processing procedure at the time of referring to a data record due to an irregular access of a subkey value, and FIG. It is a data structure state transition diagram. 11 ... Index part, 12 ... Transposed part (transposed index part), 13 ... Data part, 14,14 ', 24,24' ... Data block, 15,25 ... Record, 16 ... Transposed block, 1
9 ... Empty space, 31,33 to 39 ... Record control block, 42 ... Position information field in block, 43 ... Destination information field.

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】索引付順編成ファイルの構成要素であるデ
ータブロックに格納されている各データレコード毎に用
意されるレコード制御ブロックに、同レコード制御ブロ
ックに対応する上記データレコードが新たなデータレコ
ードの挿入に伴うブロック分割で新たなデータブロック
に移動した場合の移動先を示す移動先情報を設定するた
めの移動先情報フィールドを持つ索引付順編成ファイル
におけるレコード挿入方法であって、 上記データブロックに格納されている上記データレコー
ドを移動して上記新たなデータレコードを挿入した場合
には、移動前の上記データレコードに対応する上記レコ
ード制御ブロック内の上記移動先情報フィールドに、同
レコードの移動先を示す移動先情報を設定して、 上記ブロック分割により移動した上記データレコード
が、同レコードに対応し且つ同レコードの移動前の上記
データブロックに置かれている上記レコード制御ブロッ
ク内の上記移動先情報フィールドの設定内容に従って参
照されるようにしたことを特徴とする索引付順編成ファ
イルにおけるレコード挿入方法。
1. A record control block prepared for each data record stored in a data block which is a constituent element of an indexed sequential file, wherein the data record corresponding to the record control block is a new data record. Is a record insertion method in an indexed sequential file having a move destination information field for setting move destination information indicating a move destination when moving to a new data block by block division accompanying insertion of the data block When the above-mentioned data record stored in is moved and the above-mentioned new data record is inserted, the move of the record is moved to the move destination information field in the record control block corresponding to the data record before the move. The destination information indicating the destination is set, and the data moved by the block division is set. The data record is referred to according to the setting content of the destination information field in the record control block corresponding to the same record and placed in the data block before the movement of the same record. Record insertion method for indexed sequential files.
【請求項2】索引付順編成ファイルの構成要素であるデ
ータブロックに格納されている各データレコード毎に用
意されるレコード制御ブロックに、同レコード制御ブロ
ックに対応する上記データレコードが新たなデータレコ
ードの挿入に伴うブロック分割で新たなデータブロック
に移動した場合の移動先を示す移動先情報を設定するた
めの移動先情報フィールドを持つ索引付順編成ファイル
におけるレコード挿入および参照方法であって、 上記データブロックに格納されている上記データレコー
ドを移動して上記新たなデータレコードを挿入した場合
には、移動前の上記データレコードに対応する上記レコ
ード制御ブロック内の上記移動先情報フィールドに、同
レコードの移動先を示す移動先情報を設定して、 上記ブロック分割により移動した上記データレコード
が、副キー値による乱アクセスで、同レコードに対応し
且つ同レコードの移動前の上記データブロックに置かれ
ている上記レコード制御ブロック内の上記移動先情報フ
ィールドの設定内容に従って参照されるようにし、 この移動レコード参照時には、上記副キーの転置インデ
ックス部内の対応インデックスを探し、そのインデック
ス値を、上記参照したレコードの位置を示すように上記
設定内容に基づいて変更することを特徴とする索引付順
編成ファイルにおけるレコード挿入および参照方法。
2. A record control block prepared for each data record stored in a data block which is a constituent element of an indexed sequential file, wherein the data record corresponding to the record control block is a new data record. A record insertion and reference method in an indexed sequential file having a movement destination information field for setting movement destination information indicating a movement destination when moving to a new data block by block division accompanying insertion of When the above-mentioned data record stored in the data block is moved and the above-mentioned new data record is inserted, the same record is set in the above-mentioned move destination information field in the above-mentioned record control block corresponding to the above-mentioned data record before the move. Set the destination information that indicates the destination of the The data record is referred to according to the setting contents of the move destination information field in the record control block corresponding to the record and placed in the data block before the move of the record by the irregular access by the sub-key value. At the time of referring to this move record, the corresponding index in the inverted index part of the subkey is searched, and the index value is changed based on the setting contents so as to indicate the position of the referred record. Inserting and referencing records in indexed sequential files.
JP63160815A 1988-06-30 1988-06-30 Inserting and referencing records in indexed sequential files Expired - Lifetime JPH0789335B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63160815A JPH0789335B2 (en) 1988-06-30 1988-06-30 Inserting and referencing records in indexed sequential files

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63160815A JPH0789335B2 (en) 1988-06-30 1988-06-30 Inserting and referencing records in indexed sequential files

Publications (2)

Publication Number Publication Date
JPH0212439A JPH0212439A (en) 1990-01-17
JPH0789335B2 true JPH0789335B2 (en) 1995-09-27

Family

ID=15723020

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63160815A Expired - Lifetime JPH0789335B2 (en) 1988-06-30 1988-06-30 Inserting and referencing records in indexed sequential files

Country Status (1)

Country Link
JP (1) JPH0789335B2 (en)

Also Published As

Publication number Publication date
JPH0212439A (en) 1990-01-17

Similar Documents

Publication Publication Date Title
US4677550A (en) Method of compacting and searching a data index
US5590320A (en) Computer file directory system
US5261088A (en) Managing locality in space reuse in a shadow written B-tree via interior node free space list
Stonebraker et al. Document processing in a relational database system
US5790848A (en) Method and apparatus for data access and update in a shared file environment
US6349294B1 (en) Method of determining and storing indexing data on a sequential data storage medium for supporting random access of data files stored on the medium
US5408654A (en) Method to reorganize an index file without sorting by changing the physical order of pages to match the logical order determined from the index structure
US7529726B2 (en) XML sub-document versioning method in XML databases using record storages
Jannink Implementing deletion in B+-trees
JP4101410B2 (en) Time version data storage device
CN101685467A (en) Method and apparatus for content defined node splitting
JP2000357115A (en) Device and method for file retrieval
JPH0789335B2 (en) Inserting and referencing records in indexed sequential files
US6760713B2 (en) Method, computer program product, and system for file and record selection utilizing a fuzzy data record pointer
JP3565840B2 (en) Document management method and document management device
US6076089A (en) Computer system for retrieval of information
JP2990312B2 (en) Data access method and device
JPS62287350A (en) Index integrally updating system
JPH0225946A (en) File controller
JPH0833899B2 (en) Index update method
JP3398672B2 (en) Intermediate data storage device
JPH07219820A (en) Managing method for cyclic file
JP2785966B2 (en) Foreign key dynamic resolution processing method
JPS63276639A (en) Record addition processing method
Fischbeck The ubiquitous b-tree: volume ii