JPH0373019B2 - - Google Patents

Info

Publication number
JPH0373019B2
JPH0373019B2 JP59231252A JP23125284A JPH0373019B2 JP H0373019 B2 JPH0373019 B2 JP H0373019B2 JP 59231252 A JP59231252 A JP 59231252A JP 23125284 A JP23125284 A JP 23125284A JP H0373019 B2 JPH0373019 B2 JP H0373019B2
Authority
JP
Japan
Prior art keywords
record
records
output
memory
buffer memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP59231252A
Other languages
Japanese (ja)
Other versions
JPS61110233A (en
Inventor
Shigeo Kamya
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.)
National Institute of Advanced Industrial Science and Technology AIST
Original Assignee
Agency of Industrial Science and Technology
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 Agency of Industrial Science and Technology filed Critical Agency of Industrial Science and Technology
Priority to JP59231252A priority Critical patent/JPS61110233A/en
Publication of JPS61110233A publication Critical patent/JPS61110233A/en
Publication of JPH0373019B2 publication Critical patent/JPH0373019B2/ja
Granted legal-status Critical Current

Links

Landscapes

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

Description

【発明の詳細な説明】[Detailed description of the invention]

〔発明の技術分野〕 本発明は、ソート処理されたリレーシヨンに対
してマージ・ソート処理を基本にした関係演算に
より射影演算を効率良く実行し得るデータ処理装
置に関する。 〔発明の技術的背景とその問題点〕 大容量記憶装置の進歩に伴い、その大容量記憶
装置上で大規模なデータベースを構築する計算機
システムが増えてきている。ところが、データベ
ースが大規模になる程、該データベースから必要
なデータを検索するに必要な時間が長くなるとい
う問題が生じている。これを解決する方法の1つ
として、検索に必要な処理、つまり関係演算を専
用ハードウエアで実行することが種々提唱されて
いる。 しかして、マージ・ソート処理をベースとした
関係演算を実行する従来のデータ処理装置にあつ
ては、予めソート処理されている2つのリレーシ
ヨン間の各レコードを相互に比較し、その比較結
果に応じて上記2つのリレーシヨンの一方から選
択的にレコードを出力する動作を基体としている
ので、例えば上記データベース検索で必要な射影
演算を行なうことが困難であると云う不具合があ
つた。 即ち、この射影演算(projection)は、例えば
リレーシヨン{R1}
[Technical Field of the Invention] The present invention relates to a data processing device that can efficiently perform a projection operation on sorted relations using a relational operation based on merge/sort processing. [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. However, in conventional data processing devices that execute relational operations based on merge/sort processing, each record between two relations that has been sorted in advance is compared with each other, and the results of the comparison are Since the method is based on the operation of selectively outputting a record from one of the two relations in response to the above, there is a problem that, for example, it is difficult to perform the projection calculation necessary for the database search. That is, this projection operation is, for example, relation {R1}

【表】 から、そのキイ(属性A、属性B)の値が等しい
レーコドを取り除いて、新しいリレーシヨン
{R2}を
From [Table], remove records whose keys (attribute A, attribute B) have the same value and create a new relation {R2}.

〔発明の目的〕[Purpose of the invention]

本発明はこのような事情を考慮してなされたも
ので、その目的とするところは、例えばデータベ
ース検索処理に必要な射影演算を簡易に、且つ高
速に実現することができるデータ処理装置を提供
することにある。 〔発明の概要〕 本発明は、1レコードを処理するためびに反転
されるメモリ選択フラグを演算部に用意し、この
演算部に所定の規則に従つてソート処理が施され
た複数のレコードからなるリレーシヨンを入力す
る時、上記メモリ選択フラグが指定する第1また
は第2のレコードバツフアメモリに上記リレーシ
ヨンのレコードを1レコードづつ交互に格納する
ようにし、且つ前記第1のレコードバツフアメモ
リから読み出される第1のレコードと、前記第2
のレコードバツフアメモリから読み出される第2
のレコードとを比較回路で比較するように上記演
算部を構成し、出力選択部においては前記メモリ
選択フラグに従つて出力対象とするレコードが前
記第1のレコードか、或いは前記第2のレコード
かを選択し、この選択したレコードを出力するか
否かを前記比較回路の比較結果に従つて制御する
ことによつて射影演算を処理可能としたことを特
徴とするものである。 〔発明の効果〕 かくして本発明によれば、入力リレーシヨンの
各レコードを交互に第1および第2のレコードバ
フアメモリに格納して該第1および第2のレコー
ドバツフアメモリに2つのリレーシヨンを作成
し、これらのリレーシヨン間で各レコードの比較
を行いつつ、その比較結果に従つて前記第1およ
び第2のレコードバツフアメモリから交互に読出
されるレコードの出力を制御するので、前記2つ
のリレーシヨン間のレコードの属性を示すキイの
値が等しいとき、そのレコード出力を阻止して重
複レコードのないリレーシヨンを簡易に、且つ効
果的に作成することが可能となる。つまり、入力
リレーシヨンを交互に振分けて作成した2つのリ
レーシヨン間の各レコードの比較結果に従つて、
同一レコードが検出されたとき、そのレコードの
出力を阻止するので、ソフトウエアに頼ることな
しに、入力リレーシヨン中の重複レコードを除去
することができ、上記入力リレーシヨンに対する
射影演算を簡易に高速に実行することが可能とな
る。 〔発明の実施例〕 以下、図面を参照して本発明の一実施例につき
説明する。 図は実施例装置の概略構成図である。データ処
理装置は、基本的にはマージ・ソート処理をベー
スとした関係演算を実行する演算部1と、その関
係演算結果の出力制御を行う出力制御部2とによ
り構成される。 所定の規則に従つてソート処理が施されたリレ
ーシヨンを構成する複数のレコードは、データ処
理装置に順次入力される。演算部1は、入力レコ
ードを1語づつセツトする入力レジスタ11と、
1レコード分の記憶容量を持ち、且つFIFO(フア
ースト・イン・フアースト・アウト)機能を有す
る第1および第2のレコードバツフアメモリ1
2,13と、上記第1のレコードバツフアメモリ
12から読み出される値と第2のレコードバツフ
アメモリ13から読み出される値とを相互に比較
して、上記各値が相互に等しいときにイコール信
号を出力する比較回路14と、前記第1および第
2のレコードバツフアメモリ12,13を選択制
御するフラグ回路15とを備えて構成される。 尚、上記フラグ回路15にセツトされるメモリ
選択フラグFは、入力された1レコードが処理さ
れる都度、つまり1サイクル毎に反転制御され
る。そして上記メモリ選択フラグFが“1”のと
きには、前記第1のレコードバツフアメモリ12
が選択されて、入力レジスタ11に格納された値
が該第1のレコードバツフアメモリ12に格納さ
れる。そして上記メモリ選択フラグFが“0”の
ときには、NOT回路16を介して前記第2のレ
コードバツフアメモリ13が選択され、前記入力
レジスタ11に格納された値が該第2のレコード
バツフアメモリ13に格納される。このメモリ選
択フラグFに従つて、前記入力レジスタ11に順
次入力されるデータ(レコード)が、前記第1お
よび第2のレコードバツフアメモリ12,13に
交互に格納される。尚、前記レコードが複数の語
(データ)からなり、語単位で入力レジスタ11
にデータが入力される場合には、複数の語からな
る1つのレコードが一方のレコードバツフアメモ
リに格納されたのち、前記メモリ選択フラグFが
反転される。 しかして前記比較回路14は、上記第1および
第2のレコードバツフアメモリ12,13にそれ
ぞれ格納されたデータ(レコード)を相互に比較
し、そのデータ(レコード)が等しいとき、イコ
ール信号Eを出力している。尚、比較回路14
が、前記複数の語からなるレコードを語単位で比
較する場合には、レコードを構成する各語間での
比較結果の全てが等しいときにのみ、当該レコー
ドが等しいことになるので、各レコードの最後の
語の比較結果を得たとき、前記イコール信号Eが
有効となる。 ところで処理対象としているレコードが、その
後に続くレコードと重複していることが判明する
タイミングは、該レコードの最後の語の比較結果
を得たときとなる。この為、該レコードを一旦、
バツフアリングする必要がある。出力制御部2に
設けられた第3のレコードバツフアメモリ17
は、前記第1および第2のレコードバツフアメモ
リ12,13から順次読み出される語を、前記メ
モリ選択フラグFに従つて選択制御される選択回
路18を介して入力し、これを格納してそのレコ
ードをバツフアリングしている。この結果、第3
のレコードバフアメモリ17には、処理対象とし
ているレコードが格納されることになる。 しかして出力制御回路19は前記第3のレコー
ドバツフアメモリ17に格納されたレコードのキ
イの値が、その後に続くレコードのキイの値と重
複しているか否かを前記イコール信号Eから判定
しており、重複していない場合(E=0)には、
該第3のレーコドバツフアメモリ17に格納され
たレコードを出力レジスタ20を介して出力して
いる。また上記イコール信号Eが(E=1)の場
合には、該第3のレコードバツフアメモリ17に
格納されたレコードが後に続くレコードと重複し
ているとして、その出力を阻止している。このよ
うにして、ソート処理されたリレーシヨンの各レ
コードのキイの値が、その後に続くレコードのキ
イ値と等しい場合、そのレコードの出力が阻止さ
れて1つのリレーシヨン中の重複レコードの除
去、つまり射影演算が行われるようになつてい
る。 尚、ここでは本発明の要旨と直接関係していな
いことから図示していないが、演算部1には現在
キイ・フイールドを処理中か否かを示す回路や、
レコードの最後の1語を処理中か否かを示す回路
等が設けられることは云うまでもない。 次に、本装置における射影演算処理の流れを具
体例を挙げて説明する。 本装置における射影演算は、基本的に次のよう
に行われる。 () 先ずリレーシヨン{Rx}をそのキイの値
に対して、例えば昇順にソート処理する。例え
ばリレーシヨン{R1}の属性Aと属性Bを1
つの属性と看做してソート処理を行う。このソ
ート処理は、ソフトウエア、或るいはソート処
理専用のハードウエア(図示していない)によ
つて行われる。この結果、例えば次のようなリ
レーシヨンが得られる。
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 implement projection operations necessary for, for example, database search processing. There is a particular thing. [Summary of the Invention] The present invention provides a memory selection flag in an arithmetic unit that is inverted each time one record is processed, and the arithmetic unit includes a plurality of records sorted according to a predetermined rule. When inputting a relation, the records of the relation are alternately stored one record at a time in the first or second record buffer memory specified by the memory selection flag, and the first record buffer memory a first record read from the second record;
The second record read from the buffer memory of
The arithmetic unit is configured to compare the record with the record in the comparison circuit, and the output selection unit determines whether the record to be output is the first record or the second record according to the memory selection flag. The present invention is characterized in that a projection operation can be processed by selecting a record and controlling whether or not to output the selected record in accordance with the comparison result of the comparison circuit. [Effects of the Invention] Thus, according to the present invention, each record of an input relation is alternately stored in the first and second record buffer memories, and two relays are stored in the first and second record buffer memories. This method creates relations, compares each record between these relations, and controls the output of records alternately read from the first and second record buffer memories according to the comparison results. When the values of the keys indicating the attributes of records between the two relations are equal, output of the records is inhibited, thereby making it possible to easily and effectively create a relation without duplicate records. In other words, according to the comparison result of each record between two relations created by distributing input relations alternately,
When the same record is detected, the output of that record is blocked, so duplicate records in the input relation can be removed without relying on software, and the projection operation for the input relation can be performed easily and quickly. It becomes possible to execute it. [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 an example device. The data processing device basically includes a calculation unit 1 that executes relational calculations based on merge/sort processing, and an output control unit 2 that controls the output of the results of the relational calculations. A plurality of records constituting a relation are sorted according to predetermined rules and are sequentially input to a data processing device. The calculation unit 1 includes an input register 11 for setting input records one word at a time;
First and second record buffer memories 1 each having a storage capacity for one record and having a FIFO (first-in-first-out) function.
2 and 13, the value read from the first record buffer memory 12 and the value read from the second record buffer memory 13 are compared with each other, and when the respective values are equal to each other, an equal signal is generated. , and a flag circuit 15 for selectively controlling the first and second record buffer memories 12 and 13. The memory selection flag F set in the flag circuit 15 is inverted every time one input record is processed, that is, every cycle. When the memory selection flag F is "1", the first record buffer memory 12
is selected and the value stored in the input register 11 is stored in the first record buffer memory 12. When the memory selection flag F is "0", the second record buffer memory 13 is selected via the NOT circuit 16, and the value stored in the input register 11 is transferred to the second record buffer memory. 13. According to this memory selection flag F, data (records) sequentially input to the input register 11 are stored alternately in the first and second record buffer memories 12 and 13. Note that the record consists of a plurality of words (data), and the input register 11 is
When data is input to one of the record buffer memories, one record consisting of a plurality of words is stored in one of the record buffer memories, and then the memory selection flag F is inverted. The comparison circuit 14 compares the data (records) respectively stored in the first and second record buffer memories 12 and 13, and when the data (records) are equal, outputs an equal signal E. It is outputting. In addition, the comparison circuit 14
However, when comparing records consisting of multiple words on a word-by-word basis, the records are considered to be equal only when all of the comparison results between the words that make up the records are equal. When the comparison result of the last word is obtained, the equal signal E becomes valid. By the way, the timing at which it becomes clear that the record to be processed overlaps with the subsequent record is when the comparison result of the last word of the record is obtained. For this reason, once the record is
It is necessary to fight. Third record buffer memory 17 provided in the output control section 2
inputs the words sequentially read out from the first and second record buffer memories 12 and 13 through the selection circuit 18, which is selectively controlled according to the memory selection flag F, and stores and processes the words. I'm buffeting records. As a result, the third
The record buffer memory 17 stores records to be processed. Therefore, the output control circuit 19 determines from the equal signal E whether the key value of the record stored in the third record buffer memory 17 overlaps with the key value of the subsequent record. and there is no overlap (E=0),
The record stored in the third record buffer memory 17 is outputted via the output register 20. When the equal signal E is (E=1), it is assumed that the record stored in the third record buffer memory 17 overlaps with the following record, and its output is inhibited. In this way, if the key value of each record in a sorted relation is equal to the key value of the record that follows, the output of that record is blocked and duplicate records in a relation are removed. In other words, a projection operation is performed. Although not shown here because it is not directly related to the gist of the present invention, the calculation unit 1 includes a circuit that indicates whether or not a key field is currently being processed;
Needless to say, a circuit or the like is provided to indicate whether or not the last word of the record is being processed. Next, the flow of projection calculation processing in this apparatus will be explained using a specific example. Projection calculations in this device are basically performed as follows. () First, the relation {Rx} is sorted, for example, in ascending order with respect to its key value. For example, attribute A and attribute B of relation {R1} are 1.
Sort processing is performed by regarding it as one attribute. This sorting process is performed by software or hardware (not shown) dedicated to sorting process. As a result, the following relations are obtained, for example.

【表】 このようなリレーシヨンの各レコードを語単
位で順次入力して、本装置による射影演算が次
のようにして実行される。 () 演算部1では、先ず前記メモリ選択フラグ
Fに従つて入力レコードを交互に振分け、前記
第1および第2のレコードバツフアメモリ1
2,13上で2つのリレーシヨン{R×1}と
{R×2}を作成する。 () しかる後、両リレーシヨン{R×1}{R
×2}の先頭のレコードにポインタを置いて比
較対象とするレコードを特定し、前記メモリ選
択フラグFを{R×1}側にする(F=1)。 () 次に上記ポインタが示すレコード間でその
キイ(属性)の値を比較する。 () そして上記レコード間のキイ(属性)の値
が等しければ、そのレコードが重複していると
して前記メモリ選択フラグFが示す側のレコー
ドの出力を阻止する。 また上記レコード間のキイ(属性)の値が等
しくなければ、レコードが重複していないとし
て前記メモリ選択フラグFが示す側のレコード
を出力する。 () その後、前記メモリ選択フラグFが指す側
のポインタを次のレコードに進め、該メモリ選
択フラグFを反転する。 () そして次のレコードがあれば、前記()
の処理に戻り、次のレコードがない場合には、
前記メモリ選択フラグFが指す側のレコードを
出力してその処理を終了する。 この処理フローにおける前記()〜()の
処理について更に詳しく説明する。先ず前記
()に示す処理によつて前記第1および第2の
レコードバツフアメモリ12,13に振分けられ
て作成される2つのリレーシヨン{R×1}{R
×2}は次のようになる。
[Table] Each record of such a relation is inputted word by word sequentially, and the projection calculation by this apparatus is executed as follows. () In the arithmetic unit 1, first, input records are alternately distributed according to the memory selection flag F, and the input records are distributed to the first and second record buffer memories 1.
Create two relations {R×1} and {R×2} on 2 and 13. () After that, both relations {R×1} {R
x2}, the record to be compared is specified, and the memory selection flag F is set to the {R×1} side (F=1). () Next, compare the values of the keys (attributes) between the records indicated by the above pointer. () If the values of the keys (attributes) between the records are the same, it is assumed that the records are duplicated and the output of the record indicated by the memory selection flag F is blocked. If the values of the keys (attributes) between the records are not equal, it is determined that the records are not duplicated and the record indicated by the memory selection flag F is output. () Thereafter, the pointer pointed to by the memory selection flag F is advanced to the next record, and the memory selection flag F is inverted. () and if there is a next record, the above ()
Returns to processing and if there is no next record,
The record pointed to by the memory selection flag F is output and the process ends. The above-mentioned processes () to () in this process flow will be explained in more detail. First, the two relations {R×1} {R
×2} is as follows.

【表】 ここで、上記丸数字…は1つのレコード
を処理する為の各サイクルを示しており、下線は
上記各サイクルで前記メモリ選択フラグFが示す
リレーシヨンを表している。 しかして第1サイクルでは[1/r]と
[2/q]とを比較する。この場合、両レコード
は等しくないので、前記メモリ選択フラグF(F
=1)が選択しているレコード[1/r]出力さ
れ、その後、メモリ選択フラグFを“0”に反転
する。 次の第2サイクルでは[2/q]と[2/
q]を比較する。この場合、両レコードが等しい
のでメモリ選択フラグ(F=0)が選択している
レコード[2/q]の出力が阻止される。つま
り、そのレコードが出力されない。そして前記メ
モリ選択フラグFが“1”に反転される。 第3サイクル、第4サイクル、第5サイク
ルでは、そのレコードのキイの値が等しくない
ので、前記第1サイクルの場合と同様に、その
レコードが出力される。 以上が、本装置の基本的に射影演算の流れであ
る。 ところで前述したリレーシヨン{R1}の各レ
コードは、複数の語(属性)からなる。今、各属
性の語長を、全て1語長とし、各レコードのレコ
ード長が2語長で与えられるものとする。そして
実施例装置では1語を処理する時間を1フエーズ
とし、1レコードを処理する時間を1サイクルと
して、つまり2フエーズを1サイクルとして動作
するものとする。 この場合実施例装置では、ソート処理されたリ
レーシヨンを入力するに際し、先ず前記メモリ選
択フラグFを“1”初期設定する。 しかして第(−1)サイクルでは、上記リレー
シヨンの1番目のレコード[1/r]を入力し、
第1のレコードバツフアメモリ12に記憶する。 この第(−1)サイクルでの動作を更に詳しく
説明すると、その第1フエーズで属性Aのデータ
[1]を入力し、これを入力レジスタ11にセツ
トする。このとき前記メモリ選択フラグFが
“1”であることから、上記入力レジスタ11に
セツトされたデータ[1]を第1のレコードバツ
フアメモリ12に格納する。 次の第2フエーズでは、[r]を入力レジスタ
11にセツトし、これを同様にして第1のレコー
ドバツフアメモリ12に格納する。これによつ
て、最初のレコードの入力が終了する。その後、
前記メモリ選択フラグFを“0”に反転して第
(−1)サイクルを終え、次の第(0)サイクル
に移る。 第(0)サイクルでは、レコード[2/q]を
入力し、このとき前記メモリ選択フラグFが
“0”であることから、これを第2のレコードバ
ツフアメモリ13に記憶する。この処理は上記第
(−1)サイクルと同様にして行われるが、その
サイクルの最後で前記メモリ選択フラグFを反転
して“1”にする。 続く第1サイクルでは、次の3つの処理が平行
して行われる。 その1つは3番目のレコード[2/q]を入力
し、第1のレコードバツフアメモリ12に格納す
る動作であり、その処理は前述した第(−1)サ
イクルと同様に行われる。2つ目の動作は、第1
のレコードバツフアメモリ12から1番目のレコ
ード[1/r]を、また第2のレコードバツフア
メモリ13から2番目のレコード[2/q]をそ
れぞれ読出し、これらのレコードを比較回路14
で比較する処理動作である。そして3つ目の動作
は、前記メモリ選択フラグFに従つて、前記第1
のレコードバツフアメモリ12から読み出した1
番目のレコードを第3のレコードバツフアメモリ
17に格納する動作である。 即ち、このサイクルの第1フエーズでは、処理
は、3番目のレコードの先頭の1語である
[2]を入力して入力レジスタ11にセツトし、
これを第1のレコードバツフアメモリ12に格納
する第1の動作、FIFO機能を有する第1および
第2のレコードバツフアメモリ12,13から、
前に記憶したレコード(=1番目のレコードと2
番目のレコード)の先頭の各語[1][2]をそ
れぞれ読み出し、その語を比較する第2の動作、
および上記第1のレコードバツフアメモリ12か
ら読出した先頭の語[1]を第3のレコードバツ
フアメモリ17に格納する第3の動作からなる。 そして、その第2フエーズでは、入力した3番
目のレコードの2語目[q]を第1のレコードバ
ツフアメモリ12に格納する動作、第1および第
2のレコードバツフアメモリ12,13から、前
に記憶したレコード(=1番目のレコードと2番
目のレコード)の2番目の各語[r][q]をそ
れぞれ読み出して比較する動作、同時に上記第1
のレコードバツフアメモリ12から読出した2番
目の語[r]を第3のレコードバツフアメモリ1
7に格納する第3の動作からなる。 この第2フエーズは、レコードの最後の1語の
処理なので、前記比較回路14のイコール信号E
(E=0)を出力する。出力制御回路19は、こ
のイコール信号Eに従つて、次の第2サイクルで
前記第3のレコードバツフアメモリ17に格納し
たレコード[1/r]の出力を制御する。 しかして第2サイクルでは、前記第1サイクル
におけるレコードの比較結果が、両レコードが異
なることを示しているから、次の4つの処理が平
行に行われる。 この4つの処理のうちの3つは上述した第1サ
イクルと同様であり、これに加えて出力制御部2
におけるレコードの出力制御が前記イコール信号
Eに応じて行われる。つまり前記イコール信号E
が“0”の場合にのみ、次の第4の動作が行われ
る。この第4の動作は、第1フエーズで前記第3
のレコードバツフアメモリ17から、レコードの
1語目を読み出して出力レジスタ20にセツトし
て出力し、次の第2フエーズで前記第3のレコー
ドバツフアメモリ17から、レコードの2語目を
読み出して出力レジスタ20にセツトして出力す
る。これによりレコード[1/r]が出力され
る。 尚、前記イコール信号Eが“1”の場合、前記
その前のサイクルで比較されたレコードが等しい
ことを示すから、そのレコードの出力を阻止する
べく、第4の動作は行われない。 以降のサイクルでは、上述した第2サイクルと
同様な処理が繰返して行われる。 かくして本装置によれば第3のレコードバツフ
アメモリ17に、比較回路14のイコール信号E
を付加した形として、次のようにリレーシヨンを
得る。
[Table] Here, the circled numbers above indicate each cycle for processing one record, and the underlined lines indicate the relation indicated by the memory selection flag F in each cycle. Therefore, in the first cycle, [1/r] and [2/q] are compared. In this case, since both records are not equal, the memory selection flag F(F
The record [1/r] selected by =1) is output, and then the memory selection flag F is inverted to "0". In the next second cycle, [2/q] and [2/
q]. In this case, since both records are equal, output of the record [2/q] selected by the memory selection flag (F=0) is blocked. In other words, that record is not output. Then, the memory selection flag F is inverted to "1". In the third, fourth, and fifth cycles, the key values of the records are not equal, so the records are output in the same way as in the first cycle. The above is basically the flow of projection calculations in this device. By the way, each record of the above-mentioned relation {R1} consists of a plurality of words (attributes). Now, it is assumed that the word length of each attribute is all one word, and the record length of each record is given as two words. In the apparatus of the embodiment, the time for processing one word is assumed to be one phase, and the time for processing one record is assumed to be one cycle, that is, two phases are assumed to be one cycle. In this case, in the apparatus of this embodiment, when inputting the sorted relations, the memory selection flag F is first initialized to "1". Therefore, in the (-1)th cycle, the first record [1/r] of the above relation is input,
The data is stored in the first record buffer memory 12. To explain the operation in the (-1)th cycle in more detail, in the first phase, data [1] of attribute A is input and set in the input register 11. At this time, since the memory selection flag F is "1", the data [1] set in the input register 11 is stored in the first record buffer memory 12. In the next second phase, [r] is set in the input register 11 and stored in the first record buffer memory 12 in the same manner. This completes the input of the first record. after that,
The memory selection flag F is inverted to "0", the (-1)th cycle is completed, and the next (0)th cycle is started. In the (0)th cycle, record [2/q] is input, and since the memory selection flag F is "0" at this time, it is stored in the second record buffer memory 13. This process is performed in the same manner as the (-1)th cycle, but at the end of the cycle, the memory selection flag F is inverted and set to "1". In the subsequent first cycle, the following three processes are performed in parallel. One of them is the operation of inputting the third record [2/q] and storing it in the first record buffer memory 12, and the processing is performed in the same manner as the (-1)th cycle described above. The second action is the first
The first record [1/r] is read from the record buffer memory 12 and the second record [2/q] is read from the second record buffer memory 13, and these records are compared to the comparison circuit 14.
This is the processing operation to be compared. The third operation is based on the memory selection flag F.
1 read from the record buffer memory 12 of
This is the operation of storing the third record in the third record buffer memory 17. That is, in the first phase of this cycle, the process inputs [2], which is the first word of the third record, and sets it in the input register 11.
A first operation of storing this in the first record buffer memory 12, from the first and second record buffer memories 12 and 13 having a FIFO function,
Previously memorized records (=1st record and 2nd record)
A second operation of reading each of the first words [1] and [2] of the second record) and comparing the words;
and a third operation of storing the first word [1] read from the first record buffer memory 12 into the third record buffer memory 17. In the second phase, the second word [q] of the input third record is stored in the first record buffer memory 12, and from the first and second record buffer memories 12 and 13, The operation of reading and comparing the second words [r] and [q] of the previously stored records (=the first record and the second record), and at the same time the first
The second word [r] read from the record buffer memory 12 is transferred to the third record buffer memory 1.
The third operation consists of storing in 7. Since this second phase is processing of the last word of the record, the equal signal E of the comparison circuit 14 is processed.
(E=0) is output. In accordance with this equal signal E, the output control circuit 19 controls the output of the record [1/r] stored in the third record buffer memory 17 in the next second cycle. However, in the second cycle, since the comparison result of the records in the first cycle indicates that the two records are different, the following four processes are performed in parallel. Three of these four processes are the same as the first cycle described above, and in addition to this, the output control unit 2
Record output control is performed in accordance with the equal signal E. In other words, the equal signal E
The following fourth operation is performed only when is "0". This fourth operation is performed by the third operation in the first phase.
The first word of the record is read from the record buffer memory 17, set in the output register 20, and output, and the second word of the record is read from the third record buffer memory 17 in the next second phase. is set in the output register 20 and output. As a result, record [1/r] is output. Incidentally, when the equal signal E is "1", this indicates that the records compared in the previous cycle are equal, so the fourth operation is not performed to prevent the output of that record. In subsequent cycles, the same process as in the second cycle described above is repeated. Thus, according to the present device, the equal signal E of the comparison circuit 14 is stored in the third record buffer memory 17.
As an added form, we obtain the relation as follows.

【表】 従つてこのリレーシヨン中からイコール信号E
が“1”であるレコードの出力を阻止、つまり重
複したレコードを取除くことによつて、次のよう
な新しいリレーシヨン{R2}を得ることが可能
となる。
[Table] Therefore, from this relation, the equal signal E
By preventing the output of records for which is "1", that is, by removing duplicate records, it is possible to obtain the following new relation {R2}.

【表】 以上のように本装置によれば、メモリ選択フラ
グに従つて第1および第2のレコードバツフアメ
モリ12,13に入力レコードを交互に記憶し、
その後各レコードを読み出して比較して、その結
果により該レコードを出力するか否かを決定し、
上記メモリ選択フラグにより示されるレコードの
出力を制御するので、データ処理装置を用いて射
影演算を効果的に、且つ高速に実行することがで
きる。しかも、その処理アルゴリズムが簡単であ
り、ハードウエアにおける実現が容易である。 尚、本発明は上述した実施例に限定されるもの
ではない。例えばレコードを構成する属性の数
や、その語長等は処理対象とするデータベースの
構造等に応じて定めれば良い。またこれに応じて
1サイクルのフエーズ数を定めれば良い。その
他、本発明はその要旨を逸脱しない範囲で種々変
形して実施することができる。
[Table] As described above, according to the present device, input records are alternately stored in the first and second record buffer memories 12 and 13 according to the memory selection flag,
After that, each record is read and compared, and based on the result, it is determined whether or not to output the record,
Since the output of the record indicated by the memory selection flag is controlled, the projection operation can be executed effectively and at high speed using the data processing device. Furthermore, the processing algorithm is simple and can be easily implemented in hardware. Note that the present invention is not limited to the embodiments described above. For example, the number of attributes constituting a record, its word length, etc. may be determined depending on the structure of the database to be processed. Also, the number of phases in one cycle may be determined in accordance with this. In addition, the present invention can be implemented with various modifications without departing from the gist thereof.

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

図は本発明の一実施例装置の概略構成図であ
る。 1……演算部、2……出力制御部、11……入
力レジスタ、12……第1のレコードバツフアメ
モリ、13……第2のレコードバツフアメモリ、
14……比較回路、15……フラグ回路、16…
…NOT回路、17……第3のレコードバツフア
メモリ、18……選択回路、19……出力制御回
路、20……出力レジスタ。
The figure is a schematic configuration diagram of an apparatus according to an embodiment of the present invention. DESCRIPTION OF SYMBOLS 1... Arithmetic unit, 2... Output control unit, 11... Input register, 12... First record buffer memory, 13... Second record buffer memory,
14... Comparison circuit, 15... Flag circuit, 16...
...NOT circuit, 17...Third record buffer memory, 18...Selection circuit, 19...Output control circuit, 20...Output register.

Claims (1)

【特許請求の範囲】 1 所定の規則に従つてソート処理された複数の
レコードを順次入力すると共に、1つの入力レコ
ードを処理する都度メモリ選択フラグを反転する
手段と、この反転制御されるメモリ選択フラグに
従つて上記入力レコードを交互に記憶する第1お
よび第2のレコードバツフアメモリと、これらの
第1および第2の各レコードバツフアメモリにそ
れぞれ格納された各入力レコードを交互に読出
し、該レコードの属性を示すキイの値を相互に比
較する比較回路と、前記メモリ選択フラグに従つ
て前記第1または第2のレコードバツフアメモリ
に格納されたレコードを選択し、この選択したレ
コードを前記比較回路の比較結果が不一致の時に
出力し、且つ該比較結果が一致した時前記選択し
たレコードの出力を阻止するよう制御する出力制
御部とを具備したことを特徴とするデータ処理装
置。 2 第1および第2のレコードバツフアメモリ
は、それぞれFIFO機能を有するものであること
を特徴とする特許請求の範囲第1項記載のデータ
処理装置。
[Claims] 1. Means for sequentially inputting a plurality of records sorted according to a predetermined rule and inverting a memory selection flag each time one input record is processed, and memory selection controlled by this inversion. first and second record buffer memories that alternately store the input records in accordance with the flags, and alternately read each input record stored in each of the first and second record buffer memories, respectively; a comparison circuit that mutually compares the values of keys indicating the attributes of the records; a comparison circuit that selects a record stored in the first or second record buffer memory according to the memory selection flag; and selects the record stored in the first or second record buffer memory; A data processing device comprising: an output control section that outputs an output when the comparison result of the comparison circuit does not match, and that controls output of the selected record when the comparison result matches. 2. The data processing device according to claim 1, wherein the first and second record buffer memories each have a FIFO function.
JP59231252A 1984-11-05 1984-11-05 Data processor Granted JPS61110233A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP59231252A JPS61110233A (en) 1984-11-05 1984-11-05 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP59231252A JPS61110233A (en) 1984-11-05 1984-11-05 Data processor

Publications (2)

Publication Number Publication Date
JPS61110233A JPS61110233A (en) 1986-05-28
JPH0373019B2 true JPH0373019B2 (en) 1991-11-20

Family

ID=16920702

Family Applications (1)

Application Number Title Priority Date Filing Date
JP59231252A Granted JPS61110233A (en) 1984-11-05 1984-11-05 Data processor

Country Status (1)

Country Link
JP (1) JPS61110233A (en)

Also Published As

Publication number Publication date
JPS61110233A (en) 1986-05-28

Similar Documents

Publication Publication Date Title
JP2752634B2 (en) Sorting device
JPS6142031A (en) Sorting processor
JPH0373019B2 (en)
JPS6137654B2 (en)
JPH0782429B2 (en) How to merge multiple files
US3662402A (en) Data sort method utilizing finite difference tables
GB1104407A (en) Digital calculating arrangements
Du Binary search in a multiprocessing environment
SU658598A1 (en) Device for information retrieval from storage units
JP2735255B2 (en) Hatching treatment method
JP2835366B2 (en) Address information generator for fast Fourier transform
JP2586172B2 (en) Table search device with learning function
JPS5840769B2 (en) random number generator
JP2895892B2 (en) Data processing device
JPH0373020B2 (en)
JPH04205173A (en) Information retrieval system
JPH0833812B2 (en) Sorting device
SU1709328A1 (en) Device for processing data structures
JPS60128529A (en) Merge processing device
JPH0370826B2 (en)
JPH0926872A (en) Pipeline merge sorter
JPH02204861A (en) Vector data processor
Jones et al. Unions of certain bounded deterministic languages
JPH02294729A (en) Sort processing system
JPS5875245A (en) Relational algebra operating device

Legal Events

Date Code Title Description
EXPY Cancellation because of completion of term