JPH0370826B2 - - Google Patents
Info
- Publication number
- JPH0370826B2 JPH0370826B2 JP59231251A JP23125184A JPH0370826B2 JP H0370826 B2 JPH0370826 B2 JP H0370826B2 JP 59231251 A JP59231251 A JP 59231251A JP 23125184 A JP23125184 A JP 23125184A JP H0370826 B2 JPH0370826 B2 JP H0370826B2
- Authority
- JP
- Japan
- Prior art keywords
- record
- records
- buffer memory
- read
- relation
- 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
Links
- 230000015654 memory Effects 0.000 claims description 89
- 238000000034 method Methods 0.000 claims description 30
- 238000001514 detection method Methods 0.000 claims description 20
- 238000004364 calculation method Methods 0.000 description 6
- 230000001174 ascending effect Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
〔発明の技術分野〕
本発明は、ソート処理されている2つのリレー
シヨンに対してマージ・ソート処理を基本にした
関係演算により、併合(ジヨイン)演算を高速に
実行し得るデータ処理装置に関する。
〔発明の技術的背景とその問題点〕
大容量記憶装置の進歩に伴い、その大容量記憶
装置上で大規模なデータベースを構築する計算機
システムが増えてきている。ところが、データベ
ースが大規模になる程、該データベースから必要
なデータを検索するに必要な時間が長くなるとい
う問題が生じている。これを解決する方法の1つ
として、検索に必要な処理、つまり関係演算を専
用ハードウエアで実行することが種々提唱されて
いる。
ところで、関係演算の1つに併合(join−
equal)演算がある。この併合演算は、例えば2
つのリレーシヨン{R1}{R2}
[Technical Field of the Invention] The present invention relates to a data processing device that can perform a join operation at high speed by performing a relational operation based on a merge/sort process on two relations that are being sorted. [Technical background of the invention and its problems] With the advancement of mass storage devices, the number of computer systems that construct large-scale databases on the mass storage devices is increasing. However, as the database becomes larger, a problem arises in that the time required to search the database for necessary data becomes longer. As one method for solving this problem, various proposals have been made to execute the processing necessary for the search, that is, the relational calculations, using dedicated hardware. By the way, one of the relational operations is join
equal) operation. This merging operation is, for example, 2
Two relations {R1} {R2}
【表】
から、そのキイ(属性Aと、属性C)の値が等し
いレコードを、その組合せの数だけ結合して新し
いリレーシヨン{R3}をFrom [Table], combine the records with the same key (attribute A and attribute C) values for the number of combinations to create a new relation {R3}.
本発明はこのような事情を考慮してなされたも
ので、その目的とするところは、2つのリレーシ
ヨン間の併合演算を簡易に、且つ高速に実行する
ことができるデータ処理装置を提供することにあ
る。
〔発明の概要〕
本発明は、所定の規則に従つてソート処理が施
された複数のレコードからなる第1および第2の
リレーシヨンをそれぞれ入力して第1および第2
のレコードバツフアメモリに格納する時、各リレ
ーシヨンにおけるレコードの属性を示すキイの値
の重複を検出して、その重複検出結果を上記各レ
コードに対応させて前記第1および第2のレコー
ドバツフアメモリに格納する。そして関係演算に
必要なレコードを前記第1および第2のレコード
バツフアメモリから順次読み出して比較し、その
比較結果に従つて上記レコードの出力を制御する
とき、前記比較結果と該レコードに付された前記
重複検出結果とに従つて次に読出すレコードを制
御するようにしたものである。そして特にこのレ
コードの読出し制御を
前記比較結果が等しくない場合には前記ソー
ト処理方向に若い値のレコードを格納したレコ
ードバツフアメモリから次のレコードを読出す
と共に、他方のレコードバツフアメモリからは
同じレコードを読出し、
前記比較結果が等しいときであつて、これら
の各レコードが重複レコードでない場合には前
記第1および第2のレコードバツフアメモリか
ら次のレコードをそれぞれ読出し、
前記比較結果が等しいときであつて、一方の
レコードだけが重複レコードとして示される場
合にはそのレコードを格納したレコードバツフ
アメモリから次のレコードを読出すと共に他方
のレコードバツフアメモリからは重複レコード
中の先頭レコードを読出し、
前記比較結果が等しいときであつて、前記各
レコードが共に重複レコードとして示されると
きには前記第1のレコードバツフアメモリから
同じレコードを読出すと共に前記第2のレコー
ドバツフアメモリから次のレコードを読出す
ようにしたことを特徴とするものである。
〔発明の効果〕
かくして本発明によれば、2つのリレーシヨン
の各レコードに付された重複検出結果に従つて上
記リレーシヨン中の重複レコードについてのみ、
そのレコードの繰返し読出しを行い、その他のレ
コードについては順にその読出しを行うので、ソ
ート処理された2つのリレーシヨンをそれぞれほ
ぼ1回スキヤンニングするだけで併合演算に必要
なレコードの比較処理の全てを行うことが可能と
なる。従つて、各リレーシヨンにおけるレコード
の重複が殆んどない場合には、その処理に必要な
時間はほぼ
({R1}のレコードの数)
+({R2}のレコードの数)
となり、処理所要時間の大幅な短縮化を図ること
が可能となる。しかも各リレーシヨンのレコード
のキイの値の重複を調べておき、そのレコード重
複情報を利用して各レコードの読出し制御を行う
ので、その制御アルゴリズムが簡単であり、構成
の複雑化を招来することなしにデータ処理装置を
構築することができる等の実用上多大なる効果が
奏せられる。
〔発明の実施例〕
以下、図面を参照して本発明の一実施例につき
説明する。
図は、本発明の実施例に係るデータ処理装置の
概略構成図である。データ処理装置は、基本的に
はマージ・ソート処理をベースとした関係演算を
行う演算部と、その関係演算結果の出力制御を行
う出力制御部とにより構成される。
所定の規則に従つてソート処理が施された重複
のレコードからなる第1および第2のリレーシヨ
ンがそれぞれ入力される演算部の入力段には、各
リレーシヨン中のレコードのキイの値の重複を検
出する重複検出回路が設けられている。この重複
検出回路は、順次入力されるレコードの1語をセ
ツトする入力レジスタ11と、1レコード分の記
憶容量を持ち、かつFIFO(フアーストイン・フア
ストアウト)機能を有するレコードバツフアメモ
リ12と、このレコードバツフアメモリ12から
読出されるレコードのキイの値と前記入力レジス
タ11にセツトされた次のレコードのキイの値と
を比較する比較回路13と、上記レコードバツフ
アメモリ12から読出されるレコードを1語分づ
つセツトして次段の回路に転送するデータレジス
タ14と、前記比較回路13が出力するイコール
信号Eから前記レコードバツフアメモリ12にセ
ツトされていたレコードのキイの値が、現入力レ
コードのキイの値のと重複しているか否かを判定
し、重複している場合に重複フラグFをセツトす
るフラグ回路15とを備えて構成される。
尚、前記各レコードが複数の語によつて構成さ
れる場合、比較回路13は各語毎に比較処理して
いることから、入力リレーシヨン中の相前後する
レコードのキイ(属性)の値が重複しているか否
かが決定されるタイミングは、そのレコードの最
後の語について処理したときとなる。従つて、前
記重複フラグFは、前記レコードの最後の1語が
前記データレジスタ14を介して次段に転送され
るときに有効となる。
しかしてこのような重複検出回路を介して入力
される第1のリレーシヨンの各レコードは、第1
のレコードバツフアメモリ16に入力されて格納
される。この時、前記重複検出回路にて検出され
た各レコードについての重複検出結果(重複フラ
グF)が、そのレコードに対応して該第1のレコ
ードバツフアメモリ16に格納される。同様にし
て第2のリレーシヨンのレコードが入力されたと
き、そのレコードは前記重複検出回路を介して第
2のレコードバツフアメモリ17に格納され、各
レコードについて検出された重複検出結果(重複
フラグF)が、そのレコードに対応して該第2の
レコードバツフアメモリ17に格納される。
これらの第1および第2のレコードバツフアメ
モリ16,17は、1つのリレーシヨンのレコー
ドを記憶できる容量をそれぞれ持ち、レコード読
出し制御回路18,19の制御を受けて格納レコ
ードおよびそのレコードに付加された重複検出結
果の読出しが制御されるようになつている。
尚、上記レコード読出し制御回路18,19
は、それぞれ読出し制御用のアドレスレジスタ2
0と、バツクアツプレジスタ21とを具備して構
成される。バツクアツプレジスタ21は、後述す
るレコードの比較結果と各レコードに付された重
複検出結果(重複フラグF)とに従つて、前記ア
ドレスレジスタ20の値をセーブしたり、或いは
該バツクアツプレジスタ21に格納している値を
前記アドレスレジスタ20にロードするものであ
る。これらのアドレスレジスタ20およびバツク
アツプレジスタ21にセツトされる値の、前記比
較結果と重複検出結果(重複フラグF)とに基づ
く更新制御によつて、前記第1および第2のレコ
ードバツフアメモリ16,17から読出される各
リレーシヨンのレコードが制御される。
この他にも、本発明の要旨とは直接関係しない
ことから図示していないが、レコード読出し制御
回路18,19には書き込み用のレジスタや、こ
れらのレジスタを制御する制御回路が設けられて
いることは云うまでもない。
しかして前記第1および第2のレコードバツフ
アメモリ16,17からそれぞれ読出されるレコ
ードデータ、およびそのレコードに付された重複
検出結果の情報は、データレジスタ22,23に
それぞれセツトされる。
比較回路24は、上記データレジスタ22,2
3にそれぞれセツトされたレコードデータを相互
に比較し、その比較結果を前記レコード読出し制
御回路18,19に出力すると共に、次段の出力
制御回路25に出力している。前記レコード読出
し制御回路18,19は、このような比較回路2
4によるレコードの比較結果と、上記データレジ
スタ22,23にセツトされた重複検出結果の情
報とを入力して、前記各レジスタ20,21のセ
ツトデータを更新制御している。
1レコード分の記憶容量を持ち、且つFIFO機
能を有する第3および第4のレコードバツフアメ
モリ26,27は、前記データレジスタ22,2
3を介して前記レコードバツフアメモリ16,1
7からそれぞれ転送されてきた各レコードを、一
旦格納するものである。これらのレコードバツフ
アメモリ26,27は、前記レコードの比較処理
が語単位で行われ、その比較結果が得られるタイ
ミングがレコードの最後の語を処理した時点であ
ることから、該レコードの全ての語に対する比較
処理が終了するまで、そのレコードの各語を保存
する為に設けられるものである。そして、このよ
うにして上記各レコードバツフアメモリ26,2
7にそれぞれ格納されたレコードは、前記出力制
御回路25の制御を受けて読出し制御され、選択
回路28から出力レジスタ29を介して出力され
るようになつている。
尚、このレコードの出力は、第3のレコードバ
ツフアメモリ26に格納されたレコードと、第4
のレコードバツフアメモリ27に格納されたレコ
ードとを結合して行われる。この結合処理は選択
回路28にて、例えば第3のレコードバツフアメ
モリ26に格納されているレコードを出力した
後、第4のレコードバツフアメモリ27に格納さ
れているレコードを出力することによつて行われ
る。ここで、2つのレコードを結合して出力する
場合、前述した比較演算が2つのレコードの語数
の多いレコードの語長分によつて規定されるのに
対し、その出力所要時間は両レコードの語長の
「和」に相当した時間となる。この為、一般にレ
コードの比較演算時間より、レコードの出力処理
時間の方が多くかかる。これに対処するべく、例
えば前記演算部ではその比較演算を1サイクルの
前半で実行し、後半を待ち状態とする等すれば良
い。
この他に、演算部には現在キイ・フイールドを
処理中か否かを出力する回路や、レコードの最後
の1語、つまりサイクルの最後を処理中か否かを
出力する回路等が設けられることは勿論のことで
ある。
次に、実施例装置における併合演算処理の基本
的な流れについて説明する。
() 先ずリレーシヨン{Rx}をそのキイの
値に対し昇順(小さい順)にソート処理し、レ
コードの重複検出を行つて重複フラグFを付加
した後、第1のレコードバツフアメモリ16に
格納する。同様にリレーシヨン{Ry}をその
キイの値に対し昇順にソート処理し、レコード
の重複検出を行つて重複フラグFを付加した
後、第2のレコードバツフアメモリ17に格納
する。
() 次に上記各リレーシヨン{Rx}{Ry}
の先頭のレコードに、それぞれポインタ(以
降、これを単にポインタと称する)と、バツク
アツプ用のポインタ(以降、これをバツクアツ
プポインタと称する)を置く。
() そして上記ポインタの示すレコードをレ
コードバツフアメモリ16,17から読出して
そのキイの値を比較する。そして、上記レコー
ドのキイの値が等しければ、併合条件を満すと
して、両レコードを合せて出力し、上記キイの
値が異なる場合にはそのレコードの出力をやめ
る。
しかして、上記キイの値が等しい場合には、
そのレコードに付された重複フラグFを調べ、
その重複フラグFに従つた以下の処理を行う。
先ず両レコードの重複フラグFが共に
“0”ならば、各リレーシヨンのポインタを、
次のレコードに進める。このとき、バツクア
ツプポインタも、上記ポインタの新しい値を
セーブする。
いずれか一方のレコードの重複フラグFの
みが“1”ならば、重複フラグFが“1”で
あるレコードを含む側のリレーシヨンのポイ
ンタを次のレコードに進める。この時、バツ
クアツプポインタの値も上記ポインタの値で
同時に更新する。そして重複フラグFが
“0”であるレコードを含む側のリレーシヨ
ンについては、バツクアツプポインタが指し
ているレコードをポインタとする。この場
合、バツクアツプポインタの値は更新しな
い。
そして両レコードの重複フラグFが共に
“1”ならば、リレーシヨン{Ry}のポイン
タを次のレコードまで進め、そのバツクアツ
プポインタについては更新しない。一方、リ
レーシヨン{Rx}については、バツクアツ
プポインタが指しているレコードをポインタ
とする。
また上述したようにキイの値が異なる場合
には、キイの値の小さい方のリレーシヨン、
つまり前記ソート処理方向に若い値のキイを
持つリレーシヨンのポインタを次のレコード
まで進める。このときバツクアツプポインタ
も同時に更新する。尚、この場合には前記重
複フラグFはポインタの制御には利用されな
い。
() しかる後、前記各リレーシヨン中に次に
比較するレコードがあれば、前述した()の
処理に戻り、いずれか一方のリレーシヨンにレ
コードがなくなれば、上述した処理を終了す
る。
ところで上記()の処理において、2つのレ
コードのキイの値が等しい場合について検討する
と、各リレーシヨンにおけるレコードが重複して
いるか否かにより、4通りの状態が考えられる。
この各状態について、リレーシヨン{R4}とリ
レーシヨン{R5}を例に、前述したポインタの
制御を説明する。
(1) 両レコードが共に重複していない場合のリレ
ーシヨン{R4}{R5}は、例えば次のように
示される。
The present invention has been made in consideration of these circumstances, and its purpose is to provide a data processing device that can easily and quickly execute a merging operation between two relations. It is in. [Summary of the Invention] The present invention involves inputting first and second relations each consisting of a plurality of records that have been sorted according to a predetermined rule.
When storing the records in the record buffer memory, duplicate values of keys indicating record attributes in each relation are detected, and the duplicate detection results are stored in the first and second record buffer memory in correspondence with each record. Store in file memory. Then, when the records necessary for the relational operation are sequentially read from the first and second record buffer memories and compared, and the output of the record is controlled according to the comparison result, the records attached to the record are compared with the comparison result. The next record to be read is controlled according to the duplicate detection result. In particular, the read control of this record is performed.If the comparison results are not equal, the next record is read from the record buffer memory that stores the record with the smaller value in the direction of the sort process, and the next record is read from the other record buffer memory. reads the same record, and when the comparison results are equal and each of these records is not a duplicate record, reads the next record from the first and second record buffer memories, and the comparison results are equal; If only one record is indicated as a duplicate record, the next record is read from the record buffer memory that stored that record, and the first record of the duplicate records is read from the other record buffer memory. reading, and when the comparison results are equal and the records are both indicated as duplicate records, reading the same record from the first record buffer memory and reading the next record from the second record buffer memory; It is characterized in that it reads out. [Effects of the Invention] Thus, according to the present invention, only the duplicate records in the two relations are checked according to the duplicate detection results attached to each record in the two relations.
Since that record is read repeatedly and other records are read in order, all the record comparison processing required for the merge operation can be accomplished by scanning each of the two sorted relations almost once. It becomes possible to do so. Therefore, if there is almost no duplication of records in each relation, the time required for processing is approximately (number of records in {R1}) + (number of records in {R2}), and the processing time is It becomes possible to significantly shorten the time. Furthermore, since the duplication of key values of records in each relation is checked and the record duplication information is used to control the reading of each record, the control algorithm is simple and the configuration does not become complicated. This brings about great practical effects, such as being able to construct a data processing device without having to do so. [Embodiment of the Invention] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. The figure is a schematic configuration diagram of a data processing device according to an embodiment of the present invention. A data processing device basically includes a calculation unit that performs relational calculations based on merge/sort processing, and an output control unit that controls the output of the results of the relational calculations. The input stage of the arithmetic unit receives first and second relations consisting of duplicate records that have been sorted according to predetermined rules. A duplication detection circuit is provided to detect. This duplication detection circuit includes an input register 11 for setting one word of records input sequentially, a record buffer memory 12 having a storage capacity for one record and a FIFO (first-in/first-out) function, and a comparison circuit 13 for comparing the key value of the record read from the record buffer memory 12 with the key value of the next record set in the input register 11; The key value of the record set in the record buffer memory 12 is determined from the data register 14, which sets one word at a time and transfers it to the next stage circuit, and the equal signal E output from the comparison circuit 13. It is configured to include a flag circuit 15 that determines whether or not the key value of the input record is duplicated, and sets a duplicate flag F if it is duplicated. In addition, when each record is composed of a plurality of words, since the comparison circuit 13 performs comparison processing for each word, the values of keys (attributes) of successive records in the input relation are The timing at which it is determined whether or not there are duplicates is when the last word of the record is processed. Therefore, the duplication flag F becomes valid when the last word of the record is transferred to the next stage via the data register 14. Therefore, each record of the first relation input through such a duplicate detection circuit is
The data is input to the record buffer memory 16 and stored therein. At this time, the duplication detection result (duplication flag F) for each record detected by the duplication detection circuit is stored in the first record buffer memory 16 in correspondence with that record. Similarly, when a second relation record is input, the record is stored in the second record buffer memory 17 via the duplication detection circuit, and the duplication detection result (duplication flag F) is stored in the second record buffer memory 17 corresponding to that record. These first and second record buffer memories 16 and 17 each have a capacity to store a record of one relation, and are controlled by record readout control circuits 18 and 19 to record stored records and add data to the records. The reading of the duplicate detection results is controlled. Note that the record reading control circuits 18, 19
are address register 2 for read control, respectively.
0 and a backup register 21. The backup register 21 saves the value of the address register 20 or stores the value in the backup register 21 according to the record comparison result (described later) and the duplicate detection result (duplicate flag F) attached to each record. The stored value is loaded into the address register 20. The first and second record buffer memories 16 are updated by updating the values set in the address register 20 and the backup register 21 based on the comparison result and the duplication detection result (duplication flag F). , 17 are controlled. In addition to this, the record read control circuits 18 and 19 are provided with write registers and a control circuit that controls these registers, although they are not shown in the drawings as they are not directly related to the gist of the present invention. Needless to say. The record data read from the first and second record buffer memories 16 and 17, respectively, and the information on the duplicate detection results attached to the records are set in data registers 22 and 23, respectively. The comparison circuit 24 includes the data registers 22, 2
The record data set in 3 and 3 are compared with each other, and the comparison results are output to the record read control circuits 18 and 19 as well as to the output control circuit 25 at the next stage. The record read control circuits 18 and 19 are configured by the comparison circuit 2 as described above.
4 and the information on the duplicate detection results set in the data registers 22 and 23 are inputted to update and control the data set in each of the registers 20 and 21. The third and fourth record buffer memories 26 and 27, which have a storage capacity for one record and have a FIFO function, are connected to the data registers 22 and 2.
3 through the record buffer memory 16,1
Each record transferred from 7 to 7 is temporarily stored therein. These record buffer memories 26 and 27 store all of the records in the record buffer memory 26 and 27 because the comparison process of the records is performed word by word and the comparison result is obtained at the time when the last word of the record is processed. It is provided to save each word of the record until the comparison process for the word is completed. In this way, each of the record buffer memories 26, 2
The records stored in each of the records 7 are read out under the control of the output control circuit 25, and are outputted from the selection circuit 28 via the output register 29. Note that the output of this record is the same as the record stored in the third record buffer memory 26 and the record stored in the fourth record buffer memory 26.
This is done by combining the records stored in the record buffer memory 27. This combining process is performed by the selection circuit 28 outputting, for example, the record stored in the third record buffer memory 26 and then outputting the record stored in the fourth record buffer memory 27. It is carried out with When outputting a combination of two records, the comparison operation described above is determined by the word length of the record with the largest number of words, whereas the output time is determined by the word length of the record with the largest number of words. The time corresponds to the long word ``wa''. For this reason, record output processing time generally takes longer than record comparison calculation time. In order to deal with this, for example, the arithmetic unit may execute the comparison operation in the first half of one cycle, and put the second half in a waiting state. In addition, the arithmetic unit is provided with a circuit that outputs whether or not a key field is currently being processed, and a circuit that outputs whether or not the last word of the record, that is, the end of the cycle, is being processed. Of course. Next, the basic flow of the merging operation process in the embodiment device will be explained. () First, the relations {Rx} are sorted in ascending order (smallest first) according to their key values, duplicate records are detected, a duplicate flag F is added, and then the records are stored in the first record buffer memory 16. do. Similarly, the relation {Ry} is sorted in ascending order according to its key value, duplicate records are detected, a duplicate flag F is added, and the records are stored in the second record buffer memory 17. () Next, each of the above relations {Rx} {Ry}
A pointer (hereinafter simply referred to as a pointer) and a backup pointer (hereinafter referred to as a backup pointer) are placed in the first record of the file. () Then, the record indicated by the pointer is read from the record buffer memories 16 and 17, and the key values are compared. Then, if the key values of the records are equal, the merging condition is satisfied and both records are output together, and if the key values are different, output of that record is stopped. Therefore, if the values of the above keys are equal,
Check the duplicate flag F attached to that record,
The following processing according to the duplication flag F is performed. First, if the duplicate flags F of both records are both "0", the pointer of each relation is
Proceed to the next record. At this time, the backup pointer also saves the new value of the pointer. If only the duplication flag F of either record is "1", the pointer of the relation containing the record whose duplication flag F is "1" is advanced to the next record. At this time, the value of the backup pointer is also updated with the value of the above pointer. For a relation that includes a record for which the duplication flag F is "0", the record pointed to by the backup pointer is set as the pointer. In this case, the value of the backup pointer is not updated. If the duplication flags F of both records are both "1", the pointer of the relation {Ry} is advanced to the next record, and the backup pointer is not updated. On the other hand, for relation {Rx}, the record pointed to by the backup pointer is used as a pointer. Also, as mentioned above, if the key values are different, the relation with the smaller key value,
In other words, the pointer of the relation having the key with the smaller value is advanced to the next record in the direction of the sort processing. At this time, the backup pointer is also updated at the same time. In this case, the duplication flag F is not used for pointer control. () Thereafter, if there is a record to be compared next in each of the relations, the process returns to the process of () described above, and if there is no record in either of the relations, the process described above ends. By the way, in the above process (), if we consider the case where the key values of two records are the same, there are four possible situations depending on whether or not the records in each relation are duplicated.
Regarding each of these states, the above-mentioned pointer control will be explained using relation {R4} and relation {R5} as examples. (1) The relation {R4}{R5} when both records do not overlap is shown, for example, as follows.
【表】
しかしてこの場合には、サイクルでレコー
ド[2/G]と[2/p]とを出力する。この
サイクルの最後では、仮にリレーシヨン
{R4}あるいはリレーシヨン{R5}のポイン
タが指しているレコードを残したとしても、先
に進んだ方のポインタが指すレコードのキイの
値が、残された方のレコードのキイ値より大き
いことが明らかであることから、両リレーシヨ
ンのポインタを同時に更新できる。
次のサイクルでは両リレーシヨン共に、そ
のポインタを次のレコードである[3/T]と
[5/h]に進めて、その比較処理を行えば良
い。
(2) リレーシヨン{R4}のレコードのキイの値
が重複しており、リレーシヨン{R5}のレコ
ードのキイの値が重複していない場合の例は、
次のように示される。[Table] However, in this case, records [2/G] and [2/p] are output in cycles. At the end of this cycle, even if the record pointed to by the pointer in relation {R4} or relation {R5} is left behind, the key value of the record pointed to by the pointer to which the previous pointer moved will be the one left behind. Since it is clear that the key value is greater than the key value of the other record, the pointers of both relations can be updated at the same time. In the next cycle, both relations may advance their pointers to the next records, [3/T] and [5/h], and perform the comparison process. (2) An example where the key values of records in relation {R4} are duplicated and the key values of records in relation {R5} are not duplicated is:
It is shown as follows.
【表】
この場合には、サイクルの終りで、リレー
シヨン{R4}のポインタを[2/G]から
[2/Q]へ進ませ、リレーシヨン{R5}につ
いてはそのポインタを固定的にレコード[2/
p]を指すようにする。
そしてサイクルでは、レコードの重複フラ
グFが共に“0”となるので、両レコードのポ
インタを同時更新する。
(3) リレーシヨン{R4}のレコードのキイの値
が重複せず、リレーシヨン{R5}のレコード
のキイの値だけが重複している場合には、次の
ようになる。[Table] In this case, at the end of the cycle, the pointer of relation {R4} is advanced from [2/G] to [2/Q], and the pointer of relation {R5} is fixedly recorded. [2/
p]. Then, in the cycle, since the duplication flags F of both records become "0", the pointers of both records are updated at the same time. (3) If the key values of records in relation {R4} are not duplicated, and only the key values of records in relation {R5} are duplicated, the following will occur.
【表】
この場合には、サイクル,では、リレー
シヨン{R4}のポインタを固定的にレコード
[2/G]を指すようにし、リレーシヨン
{R5}のポインタを[2/p]から[2/t]
へと先に進ませるようにすればよい。
そしてサイクルでは、レコードの重複フラ
グFが共に“0”となることから両レコードの
ポインタの同時更新を行えば良い。
(4) 次に、両リレーシヨンのレコードのキイの値
が共に重複している場合には、例えば次のよう
になる。[Table] In this case, in the cycle, the pointer of relation {R4} is fixed to point to record [2/G], and the pointer of relation {R5} is changed from [2/p] to [2 /t]
All you have to do is move forward. Then, in the cycle, since the duplication flags F of both records become "0", it is sufficient to update the pointers of both records at the same time. (4) Next, if the key values of the records of both relations are duplicated, the following will happen, for example.
【表】
この場合には、サイクル,では、リレー
シヨン{R4}のポインタを固定的にレコード
[2/G]を指すようにし、リレーシヨン
{R5}のポインタをレコード[2/p]から
[2/t]へと先に進むようにする。但し、リ
レーシヨン{R5}のバツクアツプポインタは、
重複しているレコードの先頭のレコード[2/
p]を指したまま固定する。
サイクルでは、リレーシヨン{R4}のレ
コードの重複フラグFだけが“1”になる。そ
こで、リレーシヨン{R4}のポインタを次の
レコード[2/Z]に進め、リレーシヨン
{R5}のポインタを、上記バツクアツプポイン
タが指すレコード[2/p]に戻す。
そしてサイクル,では、リレーシヨン
{R4}のポインタを固定しておき、リレーシヨ
ン{R5}のポインタを[2/p]から[2/
t]へと先に進ませる。この時、リレーシヨン
{R4}のレコードの重複フラグFは“0”なの
で、リレーシヨン{R5}のバツクアツプポイ
ンタは更新される。
サイクルでは、両レコードの重複フラグF
が共に“0”となり、両リレーシヨンのポイン
タを共に次のレコードに進める。
以上(1)〜(4)の処理を行うことにより、両リレー
シヨンにおける[2/α]と[2/β]の全ての
組合せに対する併合演算処理がなされることにな
る。従つて、この処理の後には両リレーシヨンの
ポインタをそれぞれ先頭に戻す必要がなくなる。
次に前述した実施例装置の処理動作につき、リ
レーシヨン{R1}{R2}を例に挙げて説明する。
尚、ここではリレーシヨン{R1}{R2}の各属
性の語長が全て1語長であり、2語長で1レコー
ドが構成されるものとする。また、1語の処理時
間を1フエーズとし、1レコードの処理時間(1
サイクル)が2フエーズからなるものとする。
先ず最初に、リレーシヨン{R1}を構成する
複数のレコードを、そのキイ(属性A)の値でそ
れぞれ昇順のソート処理を施して、次のようなリ
レーシヨンを得る。[Table] In this case, in the cycle, the pointer of relation {R4} is fixed to point to record [2/G], and the pointer of relation {R5} is changed from record [2/p] to [ 2/t]. However, the backup pointer of relation {R5} is
First record of duplicate records [2/
p] and fix it. In the cycle, only the duplication flag F of the record of relation {R4} becomes "1". Therefore, the pointer of the relation {R4} is advanced to the next record [2/Z], and the pointer of the relation {R5} is returned to the record [2/p] pointed to by the backup pointer. In the cycle, the pointer of relation {R4} is fixed, and the pointer of relation {R5} is changed from [2/p] to [2/p].
t]. At this time, since the duplication flag F of the record of relation {R4} is "0", the backup pointer of relation {R5} is updated. In the cycle, the duplicate flag F for both records
both become "0", and both relation pointers advance to the next record. By performing the processes (1) to (4) above, the merging operation process is performed for all combinations of [2/α] and [2/β] in both relations. Therefore, after this process, there is no need to return the pointers of both relations to the beginning. Next, the processing operation of the above-mentioned embodiment apparatus will be explained using relation {R1}{R2} as an example.
Here, it is assumed that the word length of each attribute of relation {R1}{R2} is all one word length, and one record is composed of two word lengths. In addition, the processing time for one word is assumed to be one phase, and the processing time for one record (1
cycle) consists of two phases. First, a plurality of records constituting the relation {R1} are sorted in ascending order by the value of their key (attribute A) to obtain the following relation.
【表】
このリレーシヨン{R1}のレコードデータを
順次入力して、先ずそのリレーシヨン中に重複レ
コードがあるか否かを検査し、その検査結果をレ
コードに同期して出力する。この重複レコードの
検出は次のようにして行われる。
即ち、リレーシヨン{R1}の各レコードは、
上記したソート処理された順序で入力され、従つ
て第1サイクルではレコード[2/F]が入力さ
れる。
この第1サイクルの第1フエーズでは、1番目
のレコードの第1の語[2]が入力され、入力レ
ジスタ11にセツトされ、レコードバツフアメモ
リ12に格納される。
次の第2フエーズでは、次の第2の語[F]が
入力レジスタ11にセツトされ、前記レコードバ
ツフアメモリ12に格納される。この第1および
第2フエーズの処理によつて最初のレコードの入
力が終了する。
続く第2サイクルでは、つぎの3つの処理が平
行して行われる。
その1つは2番目のレコード[3/U]を入力
して前記レコードバツフアメモリ12に格納する
動作であり、2つ目は上記2番目のレコードと前
記レコードバツフアメモリ12から読出される1
番目のレコード[2/F]とを比較する動作であ
る。
そして3つ目は前記レコードバツフアメモリ1
2から読出した1番目のレコード[3/U]を第
1のレコードバツフアメモリ16に格納する動作
である。
この時、上記1番目のレコードに対して求めら
れた重複フラグFの値も上記第1のレコードバツ
フアメモリ16に格納する。
即ち、第1フエーズでの1つ目の処理は第1サ
イクルと同様に、2番目のレコードの先頭の1語
である[3]を入力し、入力レジスタ11にセツ
トし、同時にレコードバツフアメモリ12に格納
することにより行われる。
そしてFIFO機能を有しているレコードバツフ
アメモリ12から、1サイクル前に記憶したレコ
ードの先頭の語[2]を読出し、これをデータレ
ジスタ14を介して第1のレコードバツフアメモ
リ16に転送すると共に比較回路13に与え、前
記入力レジスタ11にセツトされている2番目の
レコードの最初の語[3]と比較する。この場
合、2つの語が等しくないこと、つまり条件に合
致していないことがわかる。
続く第2フエーズでは、入力レジスタ11か
ら、2番目のレコードの2語目の値[U]をレコ
ードバツフアメモリ12に格納し、このレコード
バツフアメモリ12から前記1番目のレコードの
次の語である[F]を読出し、これをデータレジ
スタ14を経由して第1のデーレコードバツフア
メモリ16に転送し、同時に前記入力レジスタ1
1にセツトされた語[U]と比較する。このフエ
ーズはレコードの最後の1語の処理であり、前記
1番目のレコードのキイの値が次のレコードのキ
イの値と重複していないので、比較回路13のイ
コール信号E(=0)を受けてフラグ回路15は
重複フラグF(=0)を出力する。
以下、同様な処理が各サイクル毎に行われる
が、第3サイクルではレコード[6/D]が入力
され、続く第4サイクルではレコード[6/P]
が入力されることから、、上記第3サイクルで入
力されたレコード[6/D]に対しては、重複フ
ラグF(=1)が付される。
このような重複レコードの検出処理によつて、
第1のレコードバツフアメモリ16には前記リレ
ーシヨン{R1}が次のような形で格納される。[Table] The record data of this relation {R1} is input sequentially, and first it is checked whether there is a duplicate record in the relation, and the check result is output in synchronization with the record. Detection of this duplicate record is performed as follows. That is, each record of relation {R1} is
The records are input in the sorted order described above, and therefore record [2/F] is input in the first cycle. In the first phase of this first cycle, the first word [2] of the first record is input, set in the input register 11, and stored in the record buffer memory 12. In the next second phase, the next second word [F] is set in the input register 11 and stored in the record buffer memory 12. The input of the first record is completed by the processing of the first and second phases. In the subsequent second cycle, the following three processes are performed in parallel. One is inputting the second record [3/U] and storing it in the record buffer memory 12, and the second is reading out the second record and the record buffer memory 12. 1
This is an operation of comparing the second record [2/F]. And the third is the record buffer memory 1.
This is an operation for storing the first record [3/U] read from No. 2 into the first record buffer memory 16. At this time, the value of the duplication flag F determined for the first record is also stored in the first record buffer memory 16. That is, the first process in the first phase is to input [3], which is the first word of the second record, and set it in the input register 11, as in the first cycle. This is done by storing it in 12. Then, the first word [2] of the record stored one cycle ago is read from the record buffer memory 12 having a FIFO function, and transferred to the first record buffer memory 16 via the data register 14. At the same time, it is applied to the comparison circuit 13 and compared with the first word [3] of the second record set in the input register 11. In this case, it can be seen that the two words are not equal, that is, the conditions are not met. In the subsequent second phase, the value [U] of the second word of the second record is stored in the record buffer memory 12 from the input register 11, and the next word of the first record is stored from the record buffer memory 12. [F] is read out and transferred to the first data record buffer memory 16 via the data register 14, and at the same time, the input register 1
Compare with word [U] set to 1. This phase is processing of the last word of the record, and since the key value of the first record does not overlap with the key value of the next record, the equal signal E (=0) of the comparison circuit 13 is In response, the flag circuit 15 outputs a duplication flag F (=0). Thereafter, similar processing is performed in each cycle, but in the third cycle, record [6/D] is input, and in the fourth cycle, record [6/P] is input.
is input, a duplicate flag F (=1) is attached to the record [6/D] input in the third cycle. Through this process of detecting duplicate records,
The relation {R1} is stored in the first record buffer memory 16 in the following format.
【表】
しかる後、リレーシヨン{R1}同様なソート
処理が施されたリレーシヨン{R2} を順次入
力し、同様に重複レコードの検出を行つて第2の
レコードバツフアメモリ17に次のようなリレー
シヨンを得る。[Table] After that, relation {R2} that has been subjected to the same sorting process as relation {R1} is input in sequence, duplicate records are detected in the same way, and the following is stored in the second record buffer memory 17. obtain relationships.
【表】
以上の処理を経て、各レコードバツフアメモリ
16,17に格納されたリレーシヨン間の併合演
算処理を次のようにして行う。
先ず、両リレーシヨンの先頭のレコードにポイ
ンタを置く。つまりレコード読出し制御回路1
8,19の各アドレスレジスタ20に前記各リレ
ーシヨンの先頭レコードの1番目の語、つまりレ
コード[2/F]の[2]と、レコード[1/
e]の[1]を記憶している番地を指すようにポ
インタをそれぞれセツトする。同時に各アドレス
レジスタ20にセツトされた値を、バツクアツプ
レジスタ21にそれぞれセーブする。
以上の準備を完了して、併合演算処理を開始す
る。
先ず第1サイクルでは次の3つの処理を平行し
て行う。但し、前述した重複レコードの検出処理
における第1サイクルと、ここでの第1サイクル
とは異なるタイミングである。
即ち、第1に前記第1のレコードバツフアメモ
リ16から読出したリレーシヨン{R4}の1番
目のレコード[2/F]と、第2のレコードバツ
フアメモリ17から読出したリレーシヨン{R5}
の1番目のレコード[1/e]とを比較する。そ
して第1のレコードバツフアメモリ16から読出
した1番目のレコード[2/F]を第3のレコー
ドバツフアメモリ26に格納し、第2のレコード
バツフアメモリ17から読出した1番目のレコー
ド[1/e]を第4のレコードバツフアメモリ2
7に格納する。そして次のサイクルで比較するレ
コードを選択するべく前記ポインタの制御を行
う。
具体的には、その第1フエーズでは、第1およ
び第2のレコードバツフアメモリ16,17か
ら、前記各アドレスレジスタ20が指す語[2]
[1]を同時に読出し、ころをデータレジスタ2
2,23セツトした後、比較回路24にて比較す
る。この場合、両レコードの各語の値が一致しな
いので、つまりリレーシヨン{R1}のキイの値
の方が大きいので、該レコードを出力しないこと
を決定する。そこで、出力制御回路25に対し
て、次の第2サイクルでレコード[2/F]
[1/r]を結合して出力しないように通知する。
そして前記各アドレスレジスタ20をカウントア
ツプする。尚、次のサイクルでは、上記比較され
たキイの値の小さい方のリレーシヨン{R2}の
ポインタを進め、リレーシヨン{R1}のポイン
タは元に戻す。
この処理と同時に前記各データメモリ22,2
3に格納されたデータ[2][1]をそれぞれ読
出して、前記レコードバツフアメモリ26,27
にそれぞれ格納する。
続く第2フエーズでは、前記各レコードバツフ
アメモリ16,17から、各レコードの2番目の
語[F][e]を読出し、データレジスタ22,
23を経由して、前記レコードバツフアメモリ2
6,27にそれぞれ格納する。そして、リレーシ
ヨン{R2}のレコードの方がそのキイの値が小
さいので、リレーシヨン{R2}のポインタを先
に進め、リレーシヨン{R1}のポインタはその
ままにする。即ち、この第2フエーズから次のフ
エーズである第2サイクルの第1フエーズに移る
時、レコード読出し制御回路18ではそのアドレ
スレジスタ20に、バツクアツプレジスタ21の
値をロードし、先頭のレコード[2/F]をもう
一度読出せるようにする。他方、レコード読出し
制御回路19では、そのアドレスレジスタ20を
カウントアツプし、次のレコード[2/k]を読
出せるようにする。そして、次の第2サイクルの
最初で、上記バツクアツプレジスタ21に上記ア
ドレスレジスタ20の値をセーブする。
続く第2サイクルでは、第1のレコードバツフ
アメモリ16から読出したリレーシヨン{R4}
の1番目のレコード[2/F]と、第2のレコー
ドバツフアメモリ17から読出したリレーシヨン
{R5}の2番目のレコード[2/q]とを比較す
る。
そして上記各レコードバツフアメモリ16,1
7からそれぞれ読出したレコード[2/F]
[2/q]を、前記レコードバツフアメモリ26,
27にそれぞれ格納し、次のサイクルで比較する
レコードを選択する。
以上の各処理は、第1サイクルでの処理と同様
に行われるが、この場合、読出したレコードが
[2/F][2/k]であることから、そのキイの
値が一致する。そこで次の第3サイクルでは、出
力制御回路25の出力制御によつて、前記第3お
よび第4のレコードバツフアメモリ26,27か
らそれぞれ読出されるレコード[2/F][2/
k]が結合して出力される。
またこのとき第2フエーズの終りで、その比較
結果が同値であることから、前記各レコードにそ
れぞれ付された重複フラグFが前記レコード読出
し制御回路18,19に入力される。この場合、
両レコードに付された重複フラグFが共に“0”
であることから、両リレーシヨンに対するポイン
タがそれぞれ先に進められる。つまり、各アドレ
スレジスタ20がそれぞれカウントアツプされ、
次の第3サイクルの先頭でその値が前記各バツク
アツプレジスタ21にそれぞれセーブされる。
次の第3サイクルでは、前述した第1および第
2サイクルで行われる3つの処理に加えて、レコ
ードの結合出力動作が行われる。
即ち、第3サイクルではリレーシヨン{R4}
の2番目のレコード[3/U]と、リレーシヨン
{R5}の2番目のレコード[2/k]とが比較さ
れ、同時に上記各レコード[3/U][2/k]
が前記各レコードバツフアメモリ26,27にそ
れぞれ転送して格納され、更に次のサイクルで比
較するレコードを選択する為のポインタ制御が行
われる。
これに加えて前記レコードバツフアメモリ2
6,27にそれぞれ格納され、そのキイの値が等
しいと判定された、前記リレーシヨン{R1}の
1番目のレコード[2/F]と、リレーシヨン
{R2}の2番目のレコード[2/k]が選択回路
28を介して読出され、結合して出力される。
このレコードの結合出力動作を更に詳しく説明
すると、その第1フエーズで第3のレコードバツ
フアメモリ26からレコードの先頭の語[2]を
読出し、選択回路28を経由して出力レジスタ2
9にセツトし、これを出力する。続く第2フエー
ズでは次の語[F]を読出し、同様に出力する。
しかる後、第3フエーズと第4フエーズでは、第
2のレコードバツフアメモリ27からリレーシヨ
ン{R2}のレコードの語[2][q]を順に読出
し、前記選択回路28を経由して出力レジスタ2
9にセツトして出力する。
この結果、出力レジスタ29の出力としてリレ
ーシヨン{R3}の第1番目のレコード[2/
F/2/q]が得られる。
これ以降のサイクルでは、上記第3サイクルと
同様な処理が行われる。
しかして第4サイクルでは、第3サイクルで比
較されたレコードが[3/U]と[2/k]であ
り、そのキイの値が異なることから、そのレコー
ドの結合出力は行われない。
このようなサイクルが同様にて繰返されて、第
4サイクルにてレコード[6/D][6/s]が
比較された場合、キイの値が等しいことが検出さ
れる。この場合にも上記レコード[6/D]
[6/s]が結合して出力される。しかしてこの
時、上記各レコードにそれぞれ付された重複フラ
グFが共に“1”なので、前述したようにリレー
シヨン{R1}の読出しを制御するレコード読出
し制御回路18のアドレスレジスタ20には、そ
のバツクアツプレジスタ21の値がロードされ、
再度前記レコード[6/D]が読出されるように
ポインタ制御がなされる。一方このとき、レコー
ド読出し制御回路19のアドレスレジスタ20は
カウントアツプされ、次のレコード[6/w]を
読出すようにポインタ制御される。しかし、レコ
ード読出し制御回路19のバツクアツプレジスタ
21の値はそのまま維持され、そのリレーシヨン
における重複レコードの最初、つまりレコード
[6/s]に戻れるようにしておく。
第5サイクルでも、レコードのキイの値が共に
[6]として一致する。従つてこの場合のレコー
ド[6/D][6/w]が結合されて出力される。
しかしこの場合、リレーシヨン{R1}の重複フ
ラグFだけが“1”であることから、このサイク
ルの最後で、レコード読出し制御回路18のアド
レスレジスタ20の値がカウントアツプされて次
のレコード[6/P]が読出されるようにされ、
且つそのバツクアツプレジスタ21の値が上記ア
ドレスレジスタ20の値に更新される。つまり、
このレコード[6/P]が再度読出せるようにバ
ツクアツプポインタが制御される。
そして、レコード読出し制御回路19のアドレ
スレジスタ20には、そのバツクアツプレジスタ
21に格納された値がロードされ、そのリレーシ
ヨンの重複しているレコードの先頭であるレコー
ド[6/s]が読出されるようにポインタ制御が
なされる。
次の第6サイクルでは、レコード[6/P]
[6/s]が比較され、そのキイの値が一致する
ことから該レコードの結合出力が行われる。そし
て、リレーシヨン{R2}側の重複フラグFだけ
が“1”であることから、レコード読出し制御回
路18のポインタ更新は行われず、レコード読出
し制御回路19のアドレスレジスタ20の値がカ
ウントアツプされ、且つそのバツクアツプレジス
タ21の値が上記アドレスレジスタ20の値に更
新される。
そして第7サイクルでは、レコード[6/P]
[6/w]が比較され、結合出力される。そして
この場合、上記各レコードの重複フラグFが共に
“0”であるので、そのリレーシヨンのポインタ
は共に次のレコードを指すように制御される。
然し乍ら、この場合には両リレーシヨンに次の
レコードがないことから、このサイクルでレコー
ドの比較処理が終了する。
以上に説明したように、本装置によればリレー
シヨン{R1}{R2}に対して、その先頭のレコ
ードから末尾のレコードへと、重複するレコード
を除いて1回のスキヤンによつて併合演算に必要
なレコードの比較処理を行い得る。従つて、リレ
ーシヨン中に重複するレコードが無いか、或いは
無視できる程度の重複レコード量ならば、併合演
算に必要な実行時間は、リレーシヨン{R1}の
レコードの数とリレーシヨン{R2}のレコード
の数との和に相当したサイクル時間となる。
つまり従来例では、その実行時間が両レコード
数の「積」で決つていたのが、本発明によればそ
の「和」で決まるようになる。従つて、効率良く
短時間に併合演算処理を実行することが可能とな
る。また以上の処理を、相前後して入力するレコ
ードの間でそのキイの値を比較し、その比較結果
に従つて各レコードに重複フラグFを付して行つ
ているので、簡単なアルゴリズムで効率良く併合
演算を行い得る。
尚、本発明は上述した実施例に限定されるもの
ではない。例えば各レコードを構成するキイ(属
性)の数や、そのキイ(属性)の語長、またリレ
ーシヨンを構成するリコードの数等は仕様に応じ
て定めれば良いものである。また併合条件につい
ても。特に限定されるものではない。要するに本
発明は、その要旨を逸脱しない範囲で種々変形し
て実施することができる。[Table] After the above processing, the merging calculation process between the relations stored in each record buffer memory 16, 17 is performed as follows. First, pointers are placed at the first records of both relations. In other words, record read control circuit 1
The first word of the first record of each relation, that is, [2] of record [2/F], and record [1/F] are stored in each address register 20 of 8 and 19.
Each pointer is set to point to the address where [1] of [e] is stored. At the same time, the values set in each address register 20 are saved in the backup register 21, respectively. After completing the above preparations, merge operation processing is started. First, in the first cycle, the following three processes are performed in parallel. However, the first cycle in the duplicate record detection process described above and the first cycle here are at different timings. That is, first, the first record [2/F] of the relation {R4} read from the first record buffer memory 16 and the relation {R5} read from the second record buffer memory 17.
Compare with the first record [1/e] of Then, the first record [2/F] read from the first record buffer memory 16 is stored in the third record buffer memory 26, and the first record [2/F] read from the second record buffer memory 17 is stored. 1/e] to the fourth record buffer memory 2
Store in 7. Then, the pointer is controlled to select a record to be compared in the next cycle. Specifically, in the first phase, the word [2] pointed to by each address register 20 is extracted from the first and second record buffer memories 16 and 17.
[1] is read out at the same time, and the roller is set to data register 2.
After setting 2 and 23, the comparator circuit 24 compares them. In this case, since the values of each word in both records do not match, that is, the key value of relation {R1} is larger, it is decided not to output the record. Therefore, the output control circuit 25 is instructed to record [2/F] in the next second cycle.
Notify that [1/r] should not be combined and output.
Then, each address register 20 is counted up. In the next cycle, the pointer of the relation {R2} with the smaller compared key value is advanced, and the pointer of the relation {R1} is returned to its original value. At the same time as this processing, each of the data memories 22, 2
The data [2] and [1] stored in the record buffer memories 26 and 27 are respectively read out.
Store each in In the subsequent second phase, the second word [F][e] of each record is read from each record buffer memory 16, 17, and the second word [F][e] of each record is read out from the data register 22,
23, the record buffer memory 2
6 and 27, respectively. Since the key value of the record in relation {R2} is smaller, the pointer in relation {R2} is advanced, and the pointer in relation {R1} is left unchanged. That is, when moving from the second phase to the next phase, the first phase of the second cycle, the record read control circuit 18 loads the address register 20 with the value of the backup register 21, and reads the first record [2]. /F] so that it can be read again. On the other hand, the record read control circuit 19 counts up the address register 20 so that the next record [2/k] can be read. Then, at the beginning of the next second cycle, the value of the address register 20 is saved in the backup register 21. In the subsequent second cycle, the relation {R4} read from the first record buffer memory 16 is
The first record [2/F] of the relation {R5} read from the second record buffer memory 17 is compared with the second record [2/q] of the relation {R5}. And each of the above record buffer memories 16,1
Records read from 7 [2/F]
[2/q] is stored in the record buffer memory 26,
27, and select the records to be compared in the next cycle. Each of the above processes is performed in the same way as the process in the first cycle, but in this case, since the read record is [2/F][2/k], the key values match. Therefore, in the next third cycle, records [2/F] [2/F] are read out from the third and fourth record buffer memories 26 and 27 by the output control of the output control circuit 25.
k] are combined and output. At this time, at the end of the second phase, since the comparison results are the same, the duplication flag F attached to each record is input to the record read control circuits 18 and 19. in this case,
Duplicate flag F attached to both records is both “0”
Therefore, the pointers for both relations are advanced. In other words, each address register 20 is counted up,
At the beginning of the next third cycle, the values are saved in each of the backup registers 21, respectively. In the next third cycle, in addition to the three processes performed in the first and second cycles described above, a combined output operation of records is performed. That is, in the third cycle, relation {R4}
The second record [3/U] of relation {R5} is compared with the second record [2/k] of relation {R5}, and at the same time each of the above records [3/U] [2/k]
are transferred and stored in each of the record buffer memories 26 and 27, and pointer control is performed to select a record to be compared in the next cycle. In addition to this, the record buffer memory 2
The first record [2/F] of the relation {R1} and the second record [2/F] of the relation {R2}, which are stored in 6 and 27, respectively, and whose key values are determined to be equal. k] are read out via the selection circuit 28, combined and output. To explain this combined output operation of records in more detail, in the first phase, the first word [2] of the record is read from the third record buffer memory 26, and then sent to the output register 2 via the selection circuit 28.
Set it to 9 and output this. In the subsequent second phase, the next word [F] is read out and output in the same manner.
Thereafter, in the third and fourth phases, the words [2] and [q] of the record of relation {R2} are sequentially read out from the second record buffer memory 27 and sent to the output register via the selection circuit 28. 2
Set to 9 and output. As a result, the output of the output register 29 is the first record [2/
F/2/q] is obtained. In subsequent cycles, the same processing as in the third cycle is performed. However, in the fourth cycle, the records compared in the third cycle are [3/U] and [2/k], and since their key values are different, the combined output of these records is not performed. When such a cycle is repeated in the same manner and records [6/D] [6/s] are compared in the fourth cycle, it is detected that the key values are equal. In this case, the above record [6/D]
[6/s] are combined and output. However, at this time, since the duplication flags F attached to each of the above records are both "1", the address register 20 of the record read control circuit 18 that controls the read of the relation {R1}, as described above, does not contain that value. The value of the backup register 21 is loaded,
Pointer control is performed so that the record [6/D] is read out again. On the other hand, at this time, the address register 20 of the record read control circuit 19 is counted up and the pointer is controlled to read the next record [6/w]. However, the value of the backup register 21 of the record read control circuit 19 is maintained as is, so that it is possible to return to the beginning of the duplicate records in that relation, that is, record [6/s]. In the fifth cycle as well, the key values of both records match as [6]. Therefore, records [6/D] [6/w] in this case are combined and output.
However, in this case, since only the duplication flag F of relation {R1} is "1", at the end of this cycle, the value of the address register 20 of the record read control circuit 18 is counted up and the next record [6 /P] is read out,
Moreover, the value of the backup register 21 is updated to the value of the address register 20. In other words,
The backup pointer is controlled so that this record [6/P] can be read again. Then, the address register 20 of the record read control circuit 19 is loaded with the value stored in the backup register 21, and the record [6/s] which is the head of the duplicate records of that relation is read out. Pointer control is performed so that In the next 6th cycle, record [6/P]
[6/s] are compared, and since the key values match, the records are combined and output. Since only the duplication flag F on the relation {R2} side is "1", the pointer of the record read control circuit 18 is not updated, and the value of the address register 20 of the record read control circuit 19 is counted up. Moreover, the value of the backup register 21 is updated to the value of the address register 20. And in the seventh cycle, record [6/P]
[6/w] are compared and combined and output. In this case, since the duplication flags F of the respective records are both "0", the relation pointers are controlled to point to the next record. However, in this case, since there is no next record in both relations, the record comparison process ends in this cycle. As explained above, this device performs a merge operation on relation {R1}{R2} from the first record to the last record by one scan, excluding duplicate records. It is possible to perform the necessary record comparison processing. Therefore, if there are no duplicate records in the relation, or if the amount of duplicate records is negligible, the execution time required for the merge operation is equal to the number of records in the relation {R1} and the number of records in the relation {R2}. The cycle time corresponds to the sum of the number of records. In other words, in the conventional example, the execution time was determined by the "product" of both numbers of records, but according to the present invention, it is determined by the "sum". Therefore, it becomes possible to efficiently execute the merge operation process in a short time. In addition, the above process is performed by comparing the key values between records that are input one after the other, and by attaching a duplicate flag F to each record according to the comparison result, making it efficient with a simple algorithm. Can perform merge operations well. Note that the present invention is not limited to the embodiments described above. For example, the number of keys (attributes) constituting each record, the word length of the keys (attributes), the number of records constituting a relation, etc. may be determined according to specifications. Also regarding the annexation conditions. It is not particularly limited. In short, the present invention can be implemented with various modifications without departing from the gist thereof.
図は本発明の一実施例に係るデータ処理装置の
要部概略構成図である。
11……入力レジスタ、12……レコードバツ
フアメモリ、13……比較回路、14……データ
レジスタ、15……フラグ回路、16……第1の
レコードバツフアメモリ、17……第2のレコー
ドバツフアメモリ、18,19……レコード読出
し制御回路、20……アドレスレジスタ、21…
…バツクアツプレジスタ、22,23……データ
レジスタ、24……比較回路、25……出力制御
回路、26……第3のレコードバツフアメモリ、
27……第4のレコードバツフアメモリ、28…
…選択回路、29……出力レジスタ。
The figure is a schematic configuration diagram of main parts of a data processing device according to an embodiment of the present invention. 11...Input register, 12...Record buffer memory, 13...Comparison circuit, 14...Data register, 15...Flag circuit, 16...First record buffer memory, 17...Second record Buffer memory, 18, 19...Record reading control circuit, 20...Address register, 21...
... Backup register, 22, 23 ... Data register, 24 ... Comparison circuit, 25 ... Output control circuit, 26 ... Third record buffer memory,
27...Fourth record buffer memory, 28...
...Selection circuit, 29...Output register.
Claims (1)
レコードからなる第1および第2のリレーシヨン
における上記レコードの属性を示すキイの重複を
それぞれ検出する手段と、上記第1および第2の
リレーシヨンのレコードをそれぞれ格納する第1
および第2のレコードバツフアメモリに上記重複
検出結果を前記各レコードに対応させて格納する
手段と、上記第1および第2のレコードバツフア
メモリからそれぞれ読出されたレコードの前記キ
イを相互に比較し、その比較結果に従つて上記第
1のリレーシヨン中のキイに等しい前記第2のリ
レーシヨン中のレコードを上記第1のリレーシヨ
ンのレコードと結合して出力する手段と、上記比
較結果および前記比較処理された各レコードにそ
れぞれ付された重複検出結果に従つて前記第1お
よび第2のレコードバツフアメモリから次に読出
すレコードを制御する手段とを具備し、このレコ
ードの読出しを制御する手段は、前記比較結果が
等しくない場合には前記ソート処理の方向に若い
値を有するレコードを格納したレコードバツフア
メモリから次のレコードを読出すと共に他方のレ
コードバツフアメモリからは同じレコードを読出
し、前記比較結果が等しいときには前記各レコー
ドに付された重複検出結果を調べ、これらの各レ
コードが重複レコードでない場合には前記第1お
よび第2のレコードバツフアメモリから次のレコ
ードをそれぞれ読出し、一方のレコードだけが重
複レコードとして示される場合にはそのレコード
を格納したレコードバツフアメモリから次のレコ
ードを読出すと共に他方のレコードバツフアメモ
リからは同じレコードを読出し、前記各レコード
が共に重複レコードとして示されるときには、前
記第2のレコードバツフアメモリからのレコード
をバツクアツプして保存して前記第1のレコード
バツフアメモリから同じレコードを読出すと共に
前記第2のレコードバツフアメモリから次に続く
重複レコードを順次読出し、その後前記第1のレ
コードバツフアメモリから次のレコードを読出す
と共に前記第2のレコードバツフアメモリからは
上記バツクアツプされたレコードを読出し、更に
その後前記第1のレコードバツフアメモリから同
じレコードを読出すと共に前記第2のレコードバ
ツフアメモリからは次のレコードを読出してなる
ことを特徴とするデータ処理装置。1. means for detecting duplication of keys indicating attributes of records in first and second relations consisting of a plurality of records sorted according to predetermined rules; The first one stores each record of
and means for storing the duplication detection result in a second record buffer memory in correspondence with each record, and mutually comparing the keys of the records respectively read from the first and second record buffer memories. means for combining and outputting a record in the second relation that is equal to the key in the first relation with a record in the first relation according to the comparison result; and and means for controlling the next record to be read from the first and second record buffer memories according to the duplication detection results attached to each of the records subjected to the comparison process, and controlling the reading of this record. If the comparison results are not equal, the means reads the next record from the record buffer memory storing the record having the smaller value in the direction of the sorting process, and reads the same record from the other record buffer memory. reading, and if the comparison results are equal, check the duplication detection results attached to each of the records, and if each of these records is not a duplicate record, read the next record from the first and second record buffer memories, respectively. , if only one record is indicated as a duplicate record, the next record is read from the record buffer memory that stored that record, and the same record is read from the other record buffer memory, so that each record is duplicated. When indicated as a record, the record from the second record buffer memory is backed up and stored, the same record is read from the first record buffer memory, and the next record is read from the second record buffer memory. The subsequent duplicate records are sequentially read, and then the next record is read from the first record buffer memory, and the backed up record is read from the second record buffer memory, and then the first record buffer is read. A data processing device characterized in that the same record is read from the buffer memory and the next record is read from the second record buffer memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP59231251A JPS61110232A (en) | 1984-11-05 | 1984-11-05 | Data processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP59231251A JPS61110232A (en) | 1984-11-05 | 1984-11-05 | Data processor |
Publications (2)
Publication Number | Publication Date |
---|---|
JPS61110232A JPS61110232A (en) | 1986-05-28 |
JPH0370826B2 true JPH0370826B2 (en) | 1991-11-11 |
Family
ID=16920687
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP59231251A Granted JPS61110232A (en) | 1984-11-05 | 1984-11-05 | Data processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS61110232A (en) |
-
1984
- 1984-11-05 JP JP59231251A patent/JPS61110232A/en active Granted
Also Published As
Publication number | Publication date |
---|---|
JPS61110232A (en) | 1986-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4514826A (en) | Relational algebra engine | |
US3686641A (en) | Multiprogram digital processing system with interprogram communication | |
US5060143A (en) | System for string searching including parallel comparison of candidate data block-by-block | |
JPS60134973A (en) | Vector computer | |
KR0152979B1 (en) | Variable length data processing apparatus | |
JP3076044B2 (en) | Error information storage method for pipeline | |
JPH0370826B2 (en) | ||
JPH0373021B2 (en) | ||
JPH0520350A (en) | Vector processing device | |
JPH0373020B2 (en) | ||
JP2716254B2 (en) | List vector processing device | |
JPH0833812B2 (en) | Sorting device | |
JPH04112253A (en) | Data accessing method using multilayer buffer | |
JP2798492B2 (en) | List vector processing device | |
JP2586172B2 (en) | Table search device with learning function | |
JP2539079B2 (en) | Column data selection processing circuit | |
JP2702356B2 (en) | Debug information access method | |
JPH0642248B2 (en) | Information retrieval device | |
JPH069038B2 (en) | Direct memory access controller | |
JPS6143734B2 (en) | ||
JPH0752451B2 (en) | Information retrieval device | |
JPH0373019B2 (en) | ||
JPH10301758A (en) | Sort processor | |
JPH01270127A (en) | Data retrieval processing system | |
JPS61278933A (en) | Data sorting out system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
EXPY | Cancellation because of completion of term |