JPH07210563A - Index processing method - Google Patents

Index processing method

Info

Publication number
JPH07210563A
JPH07210563A JP6001914A JP191494A JPH07210563A JP H07210563 A JPH07210563 A JP H07210563A JP 6001914 A JP6001914 A JP 6001914A JP 191494 A JP191494 A JP 191494A JP H07210563 A JPH07210563 A JP H07210563A
Authority
JP
Japan
Prior art keywords
node
direct access
data
access node
tree
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.)
Pending
Application number
JP6001914A
Other languages
Japanese (ja)
Inventor
Satoko Odawara
都子 小田原
Yusuke Mishina
雄介 三科
Moritoshi Yasunaga
守利 安永
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP6001914A priority Critical patent/JPH07210563A/en
Publication of JPH07210563A publication Critical patent/JPH07210563A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To accelerate retrieval processing concerning the index processing method using a B tree for retrieving or updating data at a data base managing system. CONSTITUTION:A direct access node setting processing part 111 decides a direct access node for enabling direct access without retrieval from a route node and stores the information in a direct access node information storage area 117. At the time of retrieval, a direct access node access processing part 112 decides the direct access node closest to retrieving object data based on the information in the direct access node information storage part 117, and a B tree search processing part 113 advances the retrieval from the direct access node, which is closest to the retrieving object data, decided by the direct access node access processing part 112 to the target retrieving object data.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、データベース管理シス
テムでデータの検索または更新のために用いられる索引
処理方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an index processing method used for searching or updating data in a database management system.

【0002】[0002]

【従来の技術】従来データベース管理システムにおける
データ格納,索引処理の実現手法として、B木が用いら
れている(月刊「インターフェイス」1991年7月号
p207からp208)。B木は、ノードと呼ばれる情報
格納節の集合である。ノードは区分値を格納する区分値
格納領域とポインタの対で構成されている。区分値の左
側に位置するポインタは区分値の値より小さい区分値ま
たはキー値をもつ別のノードを指示する。このようにノ
ード群はその最上位ノードである根ノード(以降、ルー
トノードと呼ぶ)から、最下位階層の葉ノード(以降、
リーフノードと呼ぶ)まで階層的にリンクされている。
リーフノードは上位のノードと同様、キー格納領域とポ
インタで構成されていて、ポインタはキーの値をもつデ
ータレコードの番地を指示する。
2. Description of the Related Art B-trees have been used as a method for realizing data storage and index processing in conventional database management systems (monthly "Interface", July 1991, p207 to p208). The B-tree is a set of information storage nodes called nodes. A node is composed of a pair of a segment value storage area for storing segment values and a pointer. A pointer located to the left of the partition value points to another node with a partition value or key value less than the partition value. In this way, the node group starts from the root node (hereinafter referred to as the root node), which is the highest node, to the leaf node (hereinafter,
Called a leaf node) is hierarchically linked.
Like the upper node, the leaf node is composed of a key storage area and a pointer, and the pointer points to the address of the data record having the key value.

【0003】[0003]

【発明が解決しようとする課題】従来のB木による索引
処理は、データの検索または追加,削除などをする場
合、ルートノードを出発点として、検索または追加,削
除の対象データのキー値と、ノードに格納されている区
分値またはキー値との大小関係を比較しながらノード間
のリンクを辿り、所望のキー値を格納する最下位階層ノ
ードまで移動して最終的に目的のデータに辿り着く検索
方法である。
In the conventional B-tree indexing process, when data is searched or added or deleted, the root node is used as a starting point and the key value of the data to be searched, added or deleted, Follow the links between nodes while comparing the magnitude relation with the segment value or key value stored in the node, move to the lowest hierarchy node that stores the desired key value, and finally arrive at the target data. It is a search method.

【0004】階層の段数が多くなるとキー値との大小比
較回数が多くなるため、目的のノードに達するまでの処
理時間は比例して増加する。アクセス頻度の高いデータ
に対しても検索,変更のつどルートノードから検索を開
始する必要があった。この場合でも階層の段数に比例し
た処理時間が必要となる。
Since the number of comparisons with the key value increases as the number of layers in the hierarchy increases, the processing time to reach the target node increases proportionally. Even for frequently accessed data, it was necessary to start the search from the root node each time a search or change was made. Even in this case, a processing time proportional to the number of layers in the hierarchy is required.

【0005】本発明の第一の目的は、目的のノードに達
するまでの処理時間を削減することである。
A first object of the present invention is to reduce the processing time required to reach a target node.

【0006】また、与えられた条件を満たすデータを全
データより検索する場合、ルートノードを出発点として
全リーフノードに格納されているキー値とポインタが指
示するデータレコードの内容と条件とを比較する必要が
あった。全データの検索は、各リーフノードに格納され
ているキー値の先頭から順にレコードを取り出し、最後
尾のデータまで条件判定することによる。B木に登録さ
れている全データに対して行われるため、データ件数に
比例して処理時間は増加する。
Further, when searching the data satisfying a given condition from all the data, the key value stored in all the leaf nodes is compared with the contents of the data record pointed to by the pointer and the condition, starting from the root node. Had to do. All data is retrieved by sequentially extracting records from the beginning of the key value stored in each leaf node and making a condition determination up to the last data. Since it is performed for all the data registered in the B tree, the processing time increases in proportion to the number of data items.

【0007】本発明の第二の目的は、関連するデータの
検索に要する処理時間を削減することである。
A second object of the present invention is to reduce the processing time required for searching related data.

【0008】[0008]

【課題を解決するための手段】上記第一の目的を達成す
るため、本発明の索引処理方法では直接アクセスノード
設定部と、直接アクセスノードアクセス処理部と、B木
検索処理部を備える。
In order to achieve the first object, the index processing method of the present invention comprises a direct access node setting section, a direct access node access processing section, and a B-tree search processing section.

【0009】直接アクセスノード設定部は、B木作成時
または作成後、アクセス頻度の高いデータあるいはデー
タベース操作者が指定したデータを格納するノードを、
直接アクセスノード群に登録する。または、直接アクセ
スノード決定部は、データの総件数,ノード階層の段
数,各ノードに格納されるデータの数から、適当な直接
アクセスノードを決定し、直接アクセスノード群に登録
する。直接アクセスノードとして指定されるノードはリ
ーフノード,リーフノード以外のノードのいずれでもよ
い。
The direct access node setting unit sets a node for storing frequently accessed data or data designated by a database operator at the time of or after the B tree is created.
Register directly to the access node group. Alternatively, the direct access node determination unit determines an appropriate direct access node from the total number of data items, the number of node layers, and the number of data items stored in each node, and registers the appropriate direct access node in the direct access node group. The node designated as the direct access node may be a leaf node or a node other than the leaf node.

【0010】直接アクセスノードアクセス処理部は、検
索時、検索対象のデータが直接アクセスノードリストに
登録されていればアクセスノード情報よりデータ位置を
検出して直接そのデータにアクセスする。検索データが
直接アクセスノードリストに登録されていなければ、直
接アクセスノード情報よりB木中で最も「近い」直接ア
クセスノードを検出する。
At the time of search, the direct access node access processing section detects the data position from the access node information and directly accesses the data if the search target data is registered in the direct access node list. If the search data is not registered in the direct access node list, the "closest" direct access node in the B-tree is detected from the direct access node information.

【0011】B木検索処理部は、検索時、検索対象のデ
ータが直接アクセスノードリストに登録されていなかっ
た場合、直接アクセスノードアクセス処理部により検出
されたB木中で最も「近い」直接アクセスノードを出発
点として、目的のデータを格納するノードまでB木内を
検索する。
When the search target data is not registered in the direct access node list during the search, the B-tree search processing unit departs from the "closest" direct access node in the B-tree detected by the direct access node access processing unit. As a point, the B-tree is searched up to the node that stores the target data.

【0012】上記第二の目的を達成するため、本発明の
索引処理方法では、キー値サブリンク設定処理部とキー
値サブリンク検索処理部を備える。
In order to achieve the second object, the index processing method of the present invention comprises a key value sublink setting processing section and a key value sublink search processing section.

【0013】キー値サブリンク設定処理部は、B木作成
中または作成後、データべース操作者が指定したサブリ
ンク設定条件を満たすデータを検出し、ノードの各デー
タ対応に備えられたキー値サブリンク領域に次データへ
のポインタを設定する。次データとは、キー値を昇順に
並べた場合、自データの次にサブリンク設定条件を満た
すデータを指す。
The key value sublink setting processing unit detects data that satisfies the sublink setting condition specified by the database operator during or after the B tree is created, and the key provided for each data correspondence of the node. Set the pointer to the next data in the value sublink area. The next data refers to the data that satisfies the sublink setting condition next to the own data when the key values are arranged in ascending order.

【0014】キー値サブリンク検索処理部は、検索時に
検索条件がサブリンク設定条件として指定されているも
のであれば、サブリンクの先頭データを検出し、以降各
データのサブリンク領域に設定されているポインタに沿
って検索を進める。
If the search condition is specified as a sublink setting condition at the time of search, the key value sublink search processing unit detects the head data of the sublink and is set in the sublink area of each data thereafter. The search is advanced along the pointer.

【0015】[0015]

【作用】直接アクセスノード決定部は、B木作成時また
は作成後、アクセス頻度の高いデータやデータベース操
作者が指定したデータを格納するノードを直接アクセス
ノード群に登録し、関連する情報を直接アクセスノード
情報として格納領域に格納する。あるいは、データの総
件数,ノード階層の段数,各ノードに格納されるキー値
の数、即ち、位数から、適当な直接アクセスノードを決
定して直接アクセスノード群に登録し、関連する情報を
直接アクセスノード情報として格納領域に格納する。直
接アクセスノード決定部は、ルートノードからB木中の
全階層分の大小関係の比較をすることなく直接アクセス
することができる、直接アクセスノードを提供する。
The direct access node determination unit registers the node storing the frequently accessed data or the data specified by the database operator in the direct access node group at the time of or after the B tree is created, and the related information is used as the direct access node information. Store in the storage area. Alternatively, an appropriate direct access node is determined from the total number of data items, the number of stages of the node hierarchy, and the number of key values stored in each node, that is, the order, and registered in the direct access node group, and the related information is directly accessed. It is stored in the storage area as information. The direct access node determination unit provides a direct access node that can be directly accessed from the root node without comparing the magnitude relationships of all layers in the B-tree.

【0016】直接アクセスノードアクセス処理部は、検
索時に検索対象のデータが直接アクセスノードリストに
登録されていれば、直接アクセスノード決定部が格納し
た直接アクセスノード情報よりデータ位置を検出して直
接そのノードまたはデータにアクセスする。検索データ
が直接アクセスノードリストに登録されていなければ、
直接アクセスノード情報より「B木中で最も近い」直接
アクセスノードまたはデータを検出する。ここで、「B
木中で検索対象データに最も近い直接アクセスノード」
とは、直接アクセスノード群のうち、直接アクセスノー
ドを出発点として検索対象のデータのキー値を格納する
ノードに達するまでに、上位階層への戻り回数を含めて
階層渡り回数が最小限であるようなノード中にある直接
アクセスノードのことをいう。直接アクセスノードアク
セス処理部は、ルートノードからB木中の全階層分の大
小関係の比較をすることなく直接アクセスノードにアク
セスする手段を提供する。
If the data to be searched is registered in the direct access node list at the time of search, the direct access node access processing unit detects the data position from the direct access node information stored by the direct access node determination unit, and directly detects that node or data. to access. If the search data is not directly registered in the access node list,
The "closest in the B-tree" direct access node or data is detected from the direct access node information. Here, "B
The direct access node closest to the search target data in the tree "
Means that the number of tier crossings is minimum, including the number of returns to the upper tier, until the node that stores the key value of the search target data is reached from the direct access node group as a starting point. A direct access node in a node. The direct access node access processing unit provides a means for accessing the direct access node from the root node without comparing the magnitude relationships of all layers in the B-tree.

【0017】B木検索処理部は、検索時、検索対象のデ
ータが直接アクセスノードリストに登録されていなかっ
た場合、直接アクセスノードアクセス処理部が検出した
「B木中で最も近い」直接アクセスノードまたはデータ
を出発点として、目的のデータを格納するノードまでB
木中を検索する。B木検索処理部は、ルートノードから
B木中の全階層分の大小関係の比較をすることなく目的
のノードまで検索処理する手段を提供する。
When the search target data is not registered in the direct access node list at the time of search, the B-tree search processing unit finds the "closest" direct access node or data in the B-tree detected by the direct access node access processing unit. B as a starting point to the node that stores the target data
Search through the tree. The B-tree search processing unit provides means for performing a search process from the root node to a target node without comparing the magnitude relationships of all layers in the B-tree.

【0018】キー値サブリンク設定処理部は、B木作成
中または作成後、データべース操作者が指定したサブリ
ンク設定条件にあうデータを検出し、ノードの各データ
格納領域のキー値サブリンク領域に、キー値を昇順に並
べた場合に自データの次にサブリンク設定条件を満たす
データへのポインタを設定する。キー値サブリンク設定
処理部は、全データを検索することなく指定された条件
を満たすデータのみを拾いだすことができる。
The key value sub-link setting processing unit detects data which meets the sub-link setting condition specified by the database operator during or after the B-tree is created, and the key value sub-link of each data storage area of the node is detected. In the link area, when the key values are arranged in ascending order, the pointer to the data that satisfies the sublink setting condition next to the own data is set. The key value sublink setting processing unit can retrieve only the data satisfying the specified condition without searching all the data.

【0019】キー値サブリンク検索処理部は検索時、検
索条件がサブリンク設定条件として指定されているなら
ば、サブリンクの先頭データを検出し、以降各データの
サブリンク領域に設定されているポインタに従って検索
を進める。キー値サブリンク検索処理部は、全データを
検索することなくデータのチェインに沿って指定された
条件を満たすデータのみを拾いだす手段を提供する。
During the search, the key value sublink search processing unit detects the top data of the sublink if the search condition is designated as the sublink setting condition, and is set in the sublink area of each data thereafter. Advance the search according to the pointer. The key value sublink search processing unit provides means for picking up only the data satisfying a specified condition along the chain of data without searching all the data.

【0020】[0020]

【実施例】本発明の実施例の説明に先立ち、まず本発明
による索引処理方法の全体構成の概要を図1の構成ブロ
ック図を用いて説明する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Prior to the description of the embodiments of the present invention, an outline of the overall structure of an index processing method according to the present invention will be described first with reference to the structure block diagram of FIG.

【0021】図1において、100はプロセッサを、1
10は記憶装置を、120は入出力装置を表す。記憶装
置内のB木格納領域116にはB木本体が格納されてい
る。入出力装置を経由して直接アクセスノード指定が入
力されると122,アクセスノード設定処理部111が
直接アクセスノードまたはデータを生成してその情報を
直接アクセスノード情報格納領域117に格納する。ま
た、サブリンク条件指定が入力されると123,サブリ
ンク設定処理部114がB木中のデータにサブリンクを
作成して、情報をサブリンク情報格納領域118に格納
する。検索を開始すると、直接アクセスノードアクセス
処理部112が直接アクセスノード情報格納領域117
をもとに検索対象データに最も近い直接アクセスノード
またはデータを選定して、検索対象のデータまでB木検
索処理部113が検索処理する。また、検索条件がサブ
リンク情報格納領域118にサブリンク条件として格納
されているならば、サブリンク検索処理部115が検索
処理する。
In FIG. 1, reference numeral 100 designates a processor.
Reference numeral 10 represents a storage device, and 120 represents an input / output device. A B-tree main body is stored in the B-tree storage area 116 in the storage device. When a direct access node designation is input via the input / output device 122, the access node setting processing unit 111 generates a direct access node or data and stores the information in the direct access node information storage area 117. When the sublink condition designation is input 123, the sublink setting processing unit 114 creates a sublink in the data in the B tree and stores the information in the sublink information storage area 118. When the search is started, the direct access node access processing unit 112 causes the direct access node information storage area 117
Based on, the direct access node or data closest to the search target data is selected, and the B-tree search processing unit 113 performs search processing up to the search target data. If the search condition is stored as the sublink condition in the sublink information storage area 118, the sublink search processing unit 115 performs the search process.

【0022】本発明の第一の特徴は、直接アクセスノー
ド設定部111と直接アクセスノードアクセス処理部1
12とB木検索処理部113とを備えることである。
The first feature of the present invention is that the direct access node setting unit 111 and the direct access node access processing unit 1 are provided.
12 and the B-tree search processing unit 113.

【0023】直接アクセスノード設定部111は、ルー
トノードからB木中の全階層分のノードの区分値と目的
のキー値との大小関係の比較をすることなく直接アクセ
スすることができる直接アクセスノードまたはデータを
提供する。直接アクセスノードアクセス処理部112
は、ルートノードからB木中の全階層分のノードの区分
値と目的のキー値との大小関係の比較をすることなく直
接アクセスノードまたはデータにアクセスする手段を提
供する。B木検索処理部113は、ルートノードからB
木中の全階層分のノードの区分値と目的のキー値との大
小関係の比較をすることなく、最も近い直接アクセスノ
ードまたはデータから目的のデータまでの検索処理を進
める手段を提供する。
The direct access node setting unit 111 stores a direct access node or data that can be directly accessed without comparing the size relation between the segment value of the node for all layers in the B-tree and the target key value from the root node. provide. Direct access node access processing unit 112
Provides a means for directly accessing the access node or the data from the root node without comparing the size relationship between the partition values of the nodes for all layers in the B-tree and the target key value. The B-tree search processing unit 113 starts from the root node to B
Provided is a means for advancing a search process from a nearest direct access node or data to target data without comparing the magnitude relationship between the segmental values of nodes for all layers in the tree and the target key value.

【0024】以上より、B木中のデータまたはノードに
対して、ルートノードからB木中の全階層分のノードの
区分値と目的のキー値との大小関係の比較をすることな
く直接アクセスすることが可能になる。
From the above, it is possible to directly access the data or node in the B-tree without comparing the section values of the nodes of all layers in the B-tree and the target key value from the root node. Will be possible.

【0025】本発明の第二の特徴は、キー値サブリンク
設定処理部114とキー値サブリンク検索処理部115
とを備えることである。キー値サブリンク設定処理部1
14は、全データを検索することなく指定された条件を
満たすデータのみを拾いだすことができるデータのチェ
インを提供する。キー値サブリンク検索処理部115
は、全データを検索することなくデータのチェインに従
って指定された条件にあうデータのみを拾いだす手段を
提供する。以上より、B木中の全データを検索すること
なく指定された条件にあうデータのみを拾いだすことが
可能になる。
The second feature of the present invention is that the key value sublink setting processing unit 114 and the key value sublink search processing unit 115.
And to prepare. Key value sublink setting processing unit 1
14 provides a chain of data in which only data satisfying a specified condition can be picked up without searching all data. Key value sublink search processing unit 115
Provides a means of picking up only the data that meets the specified conditions according to the chain of data without searching the entire data. As described above, it is possible to pick up only the data that meets the specified condition without searching all the data in the B tree.

【0026】次に、図2を用いてB木のノード構成を説
明する。図2の(a)に従来のB木のリーフノード以外
のノードの構成を示す。ノード番地格納領域201,2
03,205,207は下位階層のノード番地を格納す
る領域である。区分値格納領域202,204,206
は下位階層の各ノードが格納するキー値の上限を左から
昇順に格納している。ノード番値格納領域(例えば20
1)は区分値(例えば202)以下のキー値を格納する
ノードへのポインタである。
Next, the node configuration of the B-tree will be described with reference to FIG. FIG. 2A shows the configuration of nodes other than the leaf node of the conventional B tree. Node address storage areas 201, 201
Reference numerals 03, 205, and 207 are areas for storing node addresses of lower layers. Section value storage areas 202, 204, 206
Stores the upper limit of the key value stored in each node of the lower hierarchy in ascending order from the left. Node number value storage area (for example, 20
1) is a pointer to a node that stores a key value equal to or less than the segment value (for example, 202).

【0027】図2の(b)に本発明におけるB木のリー
フノード以外のノードの構成を示す。ノード番地格納領
域と区分値格納領域の対、および上位階層ノード番地格
納領域208から構成されている。上位階層ノード番地
格納領域は、自ノードの上位階層のノードの番地を格納
していて、直接アクセスノードを起点にして検索を開始
する場合に使用される。図2の(a)および(b)で、
ノード番地格納領域には上位階層または下位階層のノー
ドの番地を格納しているが、これはノード番号であって
もよい。
FIG. 2B shows the configuration of nodes other than the leaf node of the B tree in the present invention. It is composed of a pair of a node address storage area and a segment value storage area, and an upper layer node address storage area 208. The upper layer node address storage area stores the address of a node in the upper layer of the own node, and is used when starting a search starting from the direct access node. 2 (a) and (b),
The node address storage area stores the addresses of the nodes in the upper layer or the lower layer, but this may be the node number.

【0028】図2の(c)に従来のB木のリーフノード
の構成を示す。リーフノードはB木に登録されているデ
ータのキー値を格納するキー値格納領域211.21
3,215と、その付随情報を格納する付随情報格納領
域212,214,216の組から構成されている。
FIG. 2C shows the structure of a leaf node of a conventional B-tree. The leaf node is a key value storage area 211.21 that stores the key value of the data registered in the B tree.
3, 215 and associated information storage areas 212, 214, 216 for storing associated information.

【0029】これに対して本発明におけるB木のリーフ
ノードを図2の(d)に示す。本発明のリーフノードは
B木に登録されているデータのキー値を格納するキー値
格納領域と、その付随情報を格納する付随情報格納領域
と、データのサブリンク情報格納領域221,222,
223の組から構成される。サブリンク情報格納領域に
は、サブリンクが張られている場合には各データからの
サブリンク先のデータレコード番地を格納する。
On the other hand, the leaf node of the B tree in the present invention is shown in FIG. The leaf node of the present invention stores a key value storage area for storing a key value of data registered in the B-tree, an accompanying information storage area for storing its accompanying information, and sublink information storage areas 221, 222 for the data.
223 sets. When a sublink is set up, the sublink information storage area stores the data record address of the sublink destination from each data.

【0030】図3を用いてB木の構成と動作の概要を説
明する。図3の(a)は従来のB木の構成である。ノー
ド301はルートノードである。ノード304から30
9はリーフノードである。キー値が24であるようなデ
ータに対して検索処理する場合、まずルートノード中の
値311の「30」は目的のキー値「24」より大きい
ので、キー値30の左側のリンク312を辿って下の階
層のノード302に移動する。さらにここでキー値「1
0」313,「20」314との比較をして、その両方
より大きいので、キー値「20」314の右側のリンク
315を得る。辿りついたノード306は利−不ノード
である。その中のキー値「24」に対応する付随情報格
納領域よりデータレコード番地を得てそのデータへアク
セスする。
An outline of the structure and operation of the B-tree will be described with reference to FIG. FIG. 3A shows a conventional B-tree structure. The node 301 is a root node. Nodes 304 to 30
Reference numeral 9 is a leaf node. When searching for data having a key value of 24, first, the value 311 “30” in the root node is larger than the target key value “24”, so the link 312 on the left side of the key value 30 is followed. Move to the node 302 in the lower hierarchy. Furthermore, here the key value "1
The comparison is made with 0 ”313 and“ 20 ”314, and since both are larger than the both, the link 315 on the right side of the key value“ 20 ”314 is obtained. The reached node 306 is a profit / non-node. The data record address is obtained from the associated information storage area corresponding to the key value "24" in that area, and the data is accessed.

【0031】図3の(b)は本発明におけるB木の構成
である。ノード301はルートノードである。ノード3
04から309はリーフノードである。従来と同様、ル
ートノードからこの手順に従い対象のデータを検索する
こともできる。また、本発明におけるB木構成中では、
他に直接アクセスノードへのポインタ323,324と
キー値サブリンク325から331がリンクされてい
る。検索時、検索対象のキー値が直接アクセスノード情
報格納領域117中の直接アクセスノード群320に登録
されていれば(321)、その対応するポインタ322
からリンク323,324を辿って目的のノードまたは
データに到着する。例えば検索目的のキー値が「21」
ならば、直接アクセスノード郡に登録されているので
(321)、ポインタ322,324を辿ってリーフノ
ード306中のキー値が「21」であるようなデータに
アクセスすることができる。また登録されていない場
合、直接アクセスノードアクセス処理部112が決定し
た「検索対象に最も近い直接アクセスノードまたはデー
タ」に対応するポインタ322から、リンク323,32
4を辿って目的のデータまで検索する。例えば検索目的
のキー値が「24」のとき、直接アクセスノード郡に登
録されていないので、「最も近い直接アクセスノードま
たはデータ」ここではキー値「21」より(321)、
ポインタ324を辿ってリーフノード306に到着、ノ
ード内を検索して、最終的にキー値が「24」であるよう
なデータにアクセスすることができる。
FIG. 3B shows the structure of the B tree in the present invention. The node 301 is a root node. Node 3
04 to 309 are leaf nodes. Similar to the conventional method, the target data can be searched from the root node according to this procedure. Also, in the B-tree construction of the present invention,
In addition, pointers 323 and 324 to direct access nodes and key value sublinks 325 to 331 are linked. At the time of search, if the key value to be searched is registered in the direct access node group 320 in the direct access node information storage area 117 (321), the corresponding pointer 322
To reach the target node or data by following links 323 and 324. For example, the key value for search is "21"
If so, since it is registered in the direct access node group (321), it is possible to access the data having the key value “21” in the leaf node 306 by following the pointers 322 and 324. If not registered, the pointers 322 corresponding to the “direct access node or data closest to the search target” determined by the direct access node access processing unit 112 are linked to links 323, 32.
Follow 4 to search for the desired data. For example, when the key value for search is “24”, it is not registered in the direct access node group, so “closest direct access node or data” is selected from the key value “21” (321),
After arriving at the leaf node 306 by following the pointer 324 and searching the inside of the node, it is possible to finally access the data having the key value “24”.

【0032】図3中のサブリンク325から331は、
キー値が偶数である様なデータ間に設定したサブリンク
の例である。「全データのうちキー値が偶数データに対
する検索」が指定されたときには、その先頭要素ここで
はキー値「2」321からポインタ323を辿り、サブ
リンク群325から331に従ってキー値が偶数である
ような全データを検索する。
Sublinks 325 to 331 in FIG. 3 are
It is an example of a sub-link set between data such that the key value is an even number. When “search for even-numbered data among all data” is specified, the pointer 323 is traced from the first element here, the key value “2” 321, and the key value is even according to the sublink groups 325 to 331. To retrieve all data.

【0033】次に各部の処理の概要を示す。Next, an outline of the processing of each unit will be shown.

【0034】図4は、直接アクセスノード設定処理を表
わすフローチャートである。
FIG. 4 is a flowchart showing the direct access node setting process.

【0035】まず直接アクセスノード作成が指定された
場合(401)、直接アクセスノード決定処理(40
2)に進む。直接アクセスノードキー値が指定された場
合は、指定されたキー値をもって直接アクセスノードと
する(403)。指定されなかった場合は、データの総
件数,B木の位数,段数より直接アクセスノードとして
設定するノード数を算出して(404)そのノード数分
の直接アクセスノードを決定する(405)。決定され
た直接アクセスノードの区分値またはキー値とその番地
の対を直接アクセスノードリストに登録して(40
6)、直接アクセスノード決定処理を終了する。
First, when the direct access node creation is designated (401), the direct access node determination processing (40
Proceed to 2). When the direct access node key value is designated, the designated key value is set as the direct access node (403). If not specified, the number of nodes to be set as the direct access node is calculated from the total number of data, the order of the B-tree, and the number of stages (404), and the direct access nodes corresponding to the number of nodes are determined (405). A pair of the determined direct access node segment value or key value and its address is registered in the direct access node list (40
6) Then, the direct access node determination process ends.

【0036】ここでデータの総件数とはB木中の全リー
フノードに格納されているデータの総数を、位数とは各
ノードに格納されている区分値(またはキー値)の二分
の一の値を、段数とはルートノードからリーフノードま
でのノードの階層数をいう。前述の通り、直接アクセス
ノードキー値が指定されなかった場合、データの総件
数,B木の位数,段数より直接アクセスノードとして設
定するノード数を算出し(404)、そのノード数分の
直接アクセスノードを作成する。理想的には、各リーフ
ノードにつき一つ、ノードの先頭要素のデータを直接ア
クセスノードして生成し、直接アクセスノードアクセス
時には「検索対象データのキー値を超えないキー値を有
する直接アクセスノードで最大のキー値を有するノー
ド」の条件で直接アクセスノードを決定すれば、必ずア
クセスしたノード中に検索対象のデータが存在するの
で、階層を渡ることなく検索対象データにアクセスする
ことができる。また、上位階層への戻り回数がB木の段
数の二分の一以下であれば、ルートノードから検索した
場合の階層渡りの回数を超えない。情報量を削減するた
めに直接アクセスノード数を削減する場合には、段数が
N段,位数がMならば、(2Mの(二分のN)乗)個の
直接アクセスノードを作成すればよい。データ件数を均
等に等分し、各リーフノードの先頭要素のデータとして
生成し、先の例と同様のアクセスノード決定方法によれ
ば、上位階層への戻りがあってもルートノードから検索
するのに比較して少ない階層渡り回数で目的のデータを
有するリーフノードに到達することができる。
Here, the total number of data is the total number of data stored in all leaf nodes in the B-tree, and the order is one half of the segment value (or key value) stored in each node. And the number of stages means the number of layers of nodes from the root node to the leaf node. As described above, when the direct access node key value is not specified, the number of nodes to be set as the direct access node is calculated from the total number of data items, the order of the B-tree, and the number of stages (404), and the direct access nodes for the number of nodes are calculated. create. Ideally, the data of the first element of the node is generated by the direct access node, one for each leaf node, and when the direct access node is accessed, "the maximum key in the direct access node having a key value that does not exceed the key value of the search target data" is generated. If the access node is directly determined under the condition of "node having a value", the search target data always exists in the accessed node, so that the search target data can be accessed without crossing the hierarchy. If the number of returns to the upper layer is less than or equal to one half of the number of stages of the B tree, the number of layer crossings when searching from the root node is not exceeded. When the number of direct access nodes is reduced to reduce the amount of information, if the number of stages is N and the order is M, (2M (N / 2) th power) direct access nodes may be created. The number of data items is evenly divided and generated as the data of the first element of each leaf node. According to the same access node determination method as in the previous example, even if there is a return to the upper layer, the search is performed from the root node. It is possible to reach the leaf node having the target data with a smaller number of crossovers than the above.

【0037】最後に、B木探索処理のために各ノードの
上位階層ノード番号格納領域に上位階層のノード番号を
設定する(406)。B木探索処理については図6にお
いて説明する。
Finally, for the B-tree search processing, the node number of the upper layer is set in the upper layer node number storage area of each node (406). The B-tree search processing will be described with reference to FIG.

【0038】直接アクセスノードとして指定されるのは
アクセス頻度の高いデータ、またはアクセス頻度の高い
データが「B木中で近く」に密集している場合は、それ
らを代表するデータである。
Direct access nodes are designated as data that is frequently accessed, or if data that is frequently accessed is "close in the B-tree" and that is representative of them.

【0039】図5は、直接アクセスノードアクセス処理
を表わすフローチャトである。
FIG. 5 is a flow chart showing the direct access node access processing.

【0040】検索開始後(501)、指定されたデータ
のキー値(502)よりアクセスする直接アクセスノー
ドを決定する(503)。決定した直接アクセスノード
が指定されたデータであれば、その直接アクセスノード
の番地を得てデータにアクセスする(505)。決定し
た直接アクセスノードが指定されたデータそのものでな
ければ、それはB木中で検索対象データに「最も近い」
直接アクセスノードである。その直接アクセスノードを
出発点としてB木内の探索を進めて最終的に目的のデー
タに到着する。
After the search is started (501), the direct access node to be accessed is determined based on the key value (502) of the designated data (503). If the determined direct access node is the designated data, the address of the direct access node is obtained and the data is accessed (505). If the determined direct access node is not the specified data itself, it is "closest" to the search target data in the B-tree.
It is a direct access node. The direct access node is used as a starting point to proceed with the search in the B-tree and finally arrive at the target data.

【0041】「B木中で検索対象データに最も近い直接
アクセスノード」とは、その直接アクセスノード群のう
ち、その直接アクセスノードを出発点として検索対象の
データまでB木検索を進めたときに、上位階層への探索
戻り回数を含めて階層渡り全回数が最小限であるような
位置にある直接アクセスノードをさす。アクセスする直
接アクセスノード決定(503)方法には、前述の通り
「検索対象データのキー値を超えない区分値を有する直
接アクセスノードで最大の区分値を有するノード」をハ
ッシュ関数を用いて求める、同じくハッシュ関数を用い
て「検索対象データのキー値との差が最も小さい区分値
を有する直接アクセスノード」を求める、等の決定方法
がある。
The "direct access node closest to the data to be searched in the B-tree" means the upper layer when the B-tree search is advanced from the direct access node to the data to be searched starting from the direct access node. The direct access node is located at a position where the total number of times across the hierarchy including the number of search returns to is minimum. In the method of determining the direct access node to access (503), as described above, “a node having the largest partition value among the direct access nodes having the partition value that does not exceed the key value of the search target data” is obtained by using a hash function. There is a determination method such as using a function to obtain a “direct access node having a segmental value with the smallest difference from the key value of the search target data”.

【0042】図6は、B木探索処理を表わすフローチャ
ートである。B木探索処理部が動作するのは、直接アク
セスノードアクセス処理が決定した直接アクセスノード
またはその子,孫ノード内に検索対象のデータが存在し
ないとき(601)である。まず、直接アクセスノード
アクセス処理部が決定した直接アクセスノードの上位階
層ノード番地格納領域より上位階層のノード番地を得て
(602)、上位階層のノードへ移動する(603)。
移動先のノードまたはその子,孫ノード内に検索対象の
データが存在すれば(604)、従来の検索処理と同
様、ノードの区分値格納領域の区分値と検索対象データ
のキー値を比較しながらポインタに従って目的のノード
までノード間を移動(605)、目的のデータにアクセス
する(606)。移動先のノードまたはその子,孫ノード内
に検索対象のデータが存在しない場合、さらに上位階層
のノードへ移動して(603)、ノード内の区分値と検
索対象のキー値とを比較する。
FIG. 6 is a flowchart showing the B-tree search process. The B-tree search processing unit operates when there is no data to be searched in the direct access node or its child or grandchild node determined by the direct access node access processing (601). First, the direct access node access processing unit obtains the node address of the upper layer from the upper layer node address storage area of the direct access node (602) and moves to the node of the upper layer (603).
If the search target data exists in the destination node or its child or grandchild node (604), the partition value in the partition value storage area of the node is compared with the key value of the search target data as in the conventional search processing. The node is moved to the target node according to the pointer (605), and the target data is accessed (606). If the search target data does not exist in the destination node or its child or grandchild node, the node is further moved to the node in the higher hierarchy (603) and the segment value in the node is compared with the search target key value.

【0043】B木検索処理部は、ルートノードからB木
中の全階層分の大小関係の比較をして目的のノードまで
検索を進めるのでなく、直接アクセスノードアクセス処
理部が決定した「B木中で最も近い」直接アクセスノー
ドを出発点として目的のノードおよびデータまで検索を
進める。上位階層への探索戻り回数が多くなると直接ア
クセスノードの効果が低減し、逆に探索処理時間の増加
を招く。そのため直接アクセスノード設定部は、上位階
層への探索戻り回数が従来のB木探索における階層渡り
の回数を超えないよう、直接アクセスノード数を決定
し、直接アクセスノードアクセス処理は、上位階層への
探索戻り回数を含めて全階層渡り回数を最小限に抑える
ように「B木中で最も近い」直接アクセスノードを決定
している。
The B-tree search processing unit does not compare the magnitude relationships of all the layers in the B-tree from the root node and proceed with the search to the target node. The search is started from the “closest” direct access node to the target node and data. If the number of search returns to the upper hierarchy increases, the effect of the direct access node decreases, and conversely the search processing time increases. Therefore, the direct access node setting unit determines the number of direct access nodes so that the number of search returns to the upper layer does not exceed the number of times of hierarchy traversal in the conventional B-tree search, and the direct access node access process determines the number of search returns to the upper layer. Including "," the "closest" direct access node in the B-tree is determined so as to minimize the number of crossing over all layers.

【0044】図7は、サブリンク設定処理を表わすフロ
ーチャートである。サブリンク設定条件が指定された場
合(701)、まずサブリンク設定条件をサブリンク情
報格納領域711のサブリンク設定条件リストに登録す
る(702)。次に、B木の先頭要素から条件を満たすか
いなかを判定し、第一番目に条件を満たしたデータのキ
ー値またはデータレコード番地を、サブリンク情報格納
領域711のサブリンク先頭アドレスに設定し(70
3)、同時に前要素確保領域Pに当データのキー値また
はデータレコード番地を登録する(704)。継続して
B木中をサブリンク設定条件を満たすデータを探索して
いき(705)、サブリンク設定条件を満たすデータが
見つかったら(706)、前要素確保領域Pに登録され
ていた前データのキー値に備えられているサブリンク情
報格納領域(図2(c)の221から223)に自データ
データレコード番地を設定する(707)。同時に、前
要素確保領域Pに自データのキー値またはデータレコー
ド番地を新たに書き換える(708)。以下同様、B木
内を順に最後尾要素まで条件判定していき(709)、条
件を満たすデータの間にサブリンクを設定していく。
FIG. 7 is a flowchart showing the sublink setting process. When the sublink setting condition is designated (701), first, the sublink setting condition is registered in the sublink setting condition list in the sublink information storage area 711 (702). Next, it is determined from the top element of the B tree whether or not the condition is satisfied, and the key value of the data that first satisfies the condition or the data record address is set to the sublink start address of the sublink information storage area 711. (70
3) At the same time, the key value of this data or the data record address is registered in the preceding element securing area P (704). The B tree is continuously searched for data satisfying the sublink setting condition (705). When data satisfying the sublink setting condition is found (706), the previous data registered in the previous element securing area P is searched. The own data data record address is set in the sublink information storage area (221 to 223 in FIG. 2C) provided for the key value (707). At the same time, the key value of the own data or the data record address is newly rewritten in the preceding element securing area P (708). Similarly, the conditions are sequentially determined in the B-tree up to the last element (709), and sublinks are set between the data satisfying the conditions.

【0045】この処理により、指定されたサブリンク条
件を満たすデータについてキー値に従い昇順に並べたチ
ェインが作成される。キー値サブリンク設定条件が複数
設定された場合でも、全条件について同時にB木内の全
データをサブリンク条件判定すればよい。
By this processing, a chain in which the data satisfying the specified sublink condition is arranged in ascending order according to the key value is created. Even if a plurality of key value sublink setting conditions are set, all the data in the B-tree may be simultaneously judged as the sublink condition for all the conditions.

【0046】図8は、サブリンク検索処理を表わすフロ
ーチャートである。条件を満足するデータを全件に対し
て検索する場合、まずその検索条件がサブリンク情報格
納領域811のサブリンク設定条件に登録されていれば
(802)、サブリンク情報格納領域811よりデータ先
頭アドレスを得て(803)、先頭データへアクセスす
る(804)。データのリンク情報格納領域より(図2
(c)の221から223)次データのアドレスを得て
(805)、サブリンクを辿って次データへアクセスす
る(806)。この処理をサブリンクの最後尾データま
で続ける。
FIG. 8 is a flowchart showing the sublink search process. When searching for data satisfying the conditions in all cases, first, if the search condition is registered in the sublink setting condition of the sublink information storage area 811
(802), the data head address is obtained from the sublink information storage area 811 (803), and the head data is accessed (804). From the data link information storage area (Fig. 2
(221 to 223 of (c)) The address of the next data is obtained (805), and the sub data is traced to access the next data (806). This process is continued until the last data of the sublink.

【0047】[0047]

【発明の効果】B木のルートノードから全階層の区分値
比較処理,および階層移動処理をすることなく、直接ア
クセスすることができる直接アクセスノードを提供する
ことにより、最大(階層数)倍の処理高速化をすること
ができる。
By providing a direct access node that can be directly accessed from the root node of the B-tree without performing division value comparison processing of all layers and hierarchical movement processing, the processing speed can be increased by a maximum (number of layers). Can be changed.

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

【図1】本発明の全体システムのブロック図。FIG. 1 is a block diagram of the entire system of the present invention.

【図2】B木のノード構成の説明図。FIG. 2 is an explanatory diagram of a node configuration of a B tree.

【図3】B木の構成の説明図。FIG. 3 is an explanatory diagram of a configuration of a B tree.

【図4】直接アクセスノード設定処理を表わすフローチ
ャート。
FIG. 4 is a flowchart showing a direct access node setting process.

【図5】直接アクセスノードアクセス処理を表わすフロ
ーチャート。
FIG. 5 is a flowchart showing a direct access node access process.

【図6】B木探索処理を表わすフローチャート。FIG. 6 is a flowchart showing a B-tree search process.

【図7】キー値サブリンク設定処理を表わすフローチャ
ート。
FIG. 7 is a flowchart showing a key value sublink setting process.

【図8】キー値サブリンク検索処理を表わすフローチャ
ート。
FIG. 8 is a flowchart showing a key value sublink search process.

【符号の説明】[Explanation of symbols]

111…直接アクセスノード設定処理部、112…直接
アクセスノードアクセス処理部、113…B木探索処理
部、117…直接アクセスノード情報格納領域。
111 ... Direct access node setting processing unit, 112 ... Direct access node access processing unit, 113 ... B-tree search processing unit, 117 ... Direct access node information storage area.

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】計算機システムの記憶装置に格納されたB
木による索引検索処理方法において、前記B木のルート
ノードから前記B木中を探索をすることなく直接アクセ
スすることができる直接アクセスノードを備えることを
特徴とする索引処理方法。
1. A B stored in a storage device of a computer system.
The index search processing method using a tree comprises a direct access node that can be directly accessed from the root node of the B tree without searching the B tree.
【請求項2】請求項1において、 前記B木のルートノードから前記B木中を探索をするこ
となく直接アクセスすることができる前記直接アクセス
ノードを決定し、前記直接アクセスノードに関する情報
を保存する直接アクセスノード設定部と、検索処理時に
前記B木のルートノードから前記B木中の探索をするこ
となく前記直接アクセスノードに直接アクセスする直接
アクセスノードアクセス処理部と、検索対象が前記直接
アクセスノードとして設定されていない場合にはアクセ
スした前記直接アクセスノードから目的の検索対象デー
タまで検索処理するB木検索処理部とを備える索引処理
方法。
2. The direct access node setting according to claim 1, wherein the direct access node that can be directly accessed from the root node of the B tree without searching the B tree is determined, and information about the direct access node is stored. Section, a direct access node access processing section for directly accessing the direct access node from the root node of the B tree during the search processing without searching the B tree, and when the search target is not set as the direct access node. An index processing method comprising a B-tree search processing unit that performs a search process from the accessed direct access node to target search target data.
【請求項3】計算機システムの記憶装置に格納されたB
木による索引検索処理方法において、ノードの各データ
格納領域にキー値サブリンクを備えることを特徴とする
索引処理方法。
3. B stored in a storage device of a computer system
An index search method using a tree, wherein each data storage area of a node is provided with a key value sublink.
【請求項4】請求項3において、前記ノードの各データ
格納領域にキー値サブリンクを設定するキー値サブリン
ク設定部と、検索条件がサブリンク設定条件として設定
されている場合サブリンクに従って検索するキー値サブ
リンク検索処理部を備える索引処理方法。
4. The key value sublink setting unit for setting a key value sublink in each data storage area of the node according to claim 3, and when the search condition is set as the sublink setting condition, the search is performed according to the sublink. Index value processing method including a key value sublink search processing unit.
JP6001914A 1994-01-13 1994-01-13 Index processing method Pending JPH07210563A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6001914A JPH07210563A (en) 1994-01-13 1994-01-13 Index processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6001914A JPH07210563A (en) 1994-01-13 1994-01-13 Index processing method

Publications (1)

Publication Number Publication Date
JPH07210563A true JPH07210563A (en) 1995-08-11

Family

ID=11514857

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6001914A Pending JPH07210563A (en) 1994-01-13 1994-01-13 Index processing method

Country Status (1)

Country Link
JP (1) JPH07210563A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100328129B1 (en) * 1999-12-27 2002-03-12 오길록 Compacting, searching and insert method reflecting memory hierarchy
US7970769B2 (en) 2006-11-23 2011-06-28 Samsung Electronics Co., Ltd. Apparatus and method for optimized index search

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100328129B1 (en) * 1999-12-27 2002-03-12 오길록 Compacting, searching and insert method reflecting memory hierarchy
US7970769B2 (en) 2006-11-23 2011-06-28 Samsung Electronics Co., Ltd. Apparatus and method for optimized index search

Similar Documents

Publication Publication Date Title
JP3510042B2 (en) Database management method and system
JPH0554076A (en) Data search and data holding method in memory
US20070094313A1 (en) Architecture and method for efficient bulk loading of a PATRICIA trie
JP3251138B2 (en) Hash method
JP2000357115A (en) Device and method for file retrieval
JPH04260945A (en) Device and method for accessing file
JPH07210563A (en) Index processing method
JPH0581102A (en) System for controlling table
JPH08255103A (en) Method and device for file management
JPH06139280A (en) File management system
JP2003296157A (en) Data storage device, data processor, data processing method, and data processing program
JP2000066933A (en) Time series data management system
JP2001155028A (en) Aggregate calculation processing method and device for relational database, and computer readable recording medium recorded with aggregate arithmetic processing program
JP2001134598A (en) Structuring method and retrieving method for t-tree index, structuring device and retrieving device for t- tree index, storage medium stored with t-tree index structuring program, and storage medium stored with t-tree index retrieving program
JPH07219820A (en) Managing method for cyclic file
JPS61160133A (en) Data input control method
JPH01248233A (en) Data base retrieving device
JP3398672B2 (en) Intermediate data storage device
JPH04373072A (en) Data base retrieval system utilizing case
JPH02127742A (en) Idle area retrieving system
JPS61184635A (en) Retrieving system for data base system
JPH05143644A (en) Index part management system
JPH08129556A (en) Data storing method
JP2003330957A (en) Set attribute retrieval system, method, and program
JPH11353212A (en) Method and device for managing member in area sharing file