JPS6162134A - Sort preprocessor - Google Patents

Sort preprocessor

Info

Publication number
JPS6162134A
JPS6162134A JP18373684A JP18373684A JPS6162134A JP S6162134 A JPS6162134 A JP S6162134A JP 18373684 A JP18373684 A JP 18373684A JP 18373684 A JP18373684 A JP 18373684A JP S6162134 A JPS6162134 A JP S6162134A
Authority
JP
Japan
Prior art keywords
memory
address
record
byte
read
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
JP18373684A
Other languages
Japanese (ja)
Inventor
Akihiro Hiruma
比留間 晶大
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 JP18373684A priority Critical patent/JPS6162134A/en
Publication of JPS6162134A publication Critical patent/JPS6162134A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To speed up the sort processing and to make a buffer memory unnecessary by applying the processing to a sort object record and transferring the specified key field to the forefront of the record. CONSTITUTION:First, the initializing processing is carried out, and a sort object record is led to a memory 11. Under the control of a control circuit 24, the writing in the memory 11 in accordance with a write address WA from an address register 14 is carried oyut. Then the circuit 24 controls a multiplexer 18, and makes it select a read commencement address IAP from an IPA register 16, thereby setting this to an address register 15. The circuit 24 controls a multiplexer 19, and switches the address WA with respect to the memory 11 into an read address RA, thereby controlling the reading with respect to the memory 11. The register 15 is added by one at each byte reading. Thus, the record written in the memory 11 is read out on a data line 13 by the unit of one byte sequentially from the forefront byte of the key field, and then led to a sort processor.

Description

【発明の詳細な説明】 [発明の技術分野] この発明は、特にソート処理の効率化のために、ソート
処理の対象レコードに前処理を施すソー1〜前処理装置
に関する。
DETAILED DESCRIPTION OF THE INVENTION [Technical Field of the Invention] The present invention relates to a saw 1 to a preprocessing device that performs preprocessing on records to be sorted, particularly in order to improve the efficiency of sorting.

[発明の技術的背景] 関係データベースなどのデータベース処理における主た
る処理の1つにソート処理がある。このソート処理は、
特定のファイル中の複数のレコードの並びを、レコード
中の指定されたキーフィールドの値に従って所定の順序
に並び賛えることである。上記したソート処理は、汎用
電子計(511でも実行可能である。しかし、汎用電子
計算機が取出中、「データベース処理や文書処理を高速
化するサーチ/ソート・ハードウェアの動向」、「日経
エレクトロニクスj 、 1983年8月 1日号、 
pp。
[Technical Background of the Invention] One of the main processes in database processing such as a relational database is sorting processing. This sorting process is
It is to arrange a plurality of records in a specific file in a predetermined order according to the values of specified key fields in the records. The sorting process described above can also be executed on a general-purpose computer (511). , August 1, 1983 issue,
pp.

141−178 、に示される(特にpp、 164−
165 、 )ようなマージソート方式のソート処理装
置が知られている。このソート処理装置は、一般に多段
に縦続接続された複数のソート・セルからなる。n段目
のソート・セルは、前段のソート・セルまででソートさ
れている2n −1個のレコードを2組入力し、2n個
のレコードをソートし、次段に出力する機能を有してい
る。このソート・セルのソート処理においては、各組か
らその入力順にそれぞれ1個のレコードが選択され、2
個のレコード間のキーフィールドの比較が行なわれ、そ
の比較結果に応じて出力すべきレコードが確定される。
141-178 (particularly pp, 164-
Merge sort type sorting processing devices such as No. 165, ) are known. This sort processing device generally consists of a plurality of sort cells connected in cascade in multiple stages. The n-th sorting cell has the function of inputting two sets of 2n -1 records that have been sorted up to the previous sorting cell, sorting the 2n records, and outputting them to the next stage. There is. In this sort cell sorting process, one record is selected from each set in the order of input, and two
The key fields are compared between the records, and the record to be output is determined according to the comparison result.

このため、上記したソート処理装置においては、キとす
る欠点があった。また、指定されたキーフィてからキー
フィールドの比較が終了するまでに長時間を要し、ソー
ト処理速度が低下する欠点もあった。
For this reason, the above-mentioned sorting processing apparatus has a major drawback. Another disadvantage is that it takes a long time to complete the comparison of key fields after the specified key field is entered, reducing the sorting processing speed.

[発明の目的] この発明は上記事情に鑑みてなされたものでその目的は
、ソート対象レコードに前処理を施し、指定されたキー
フィールドをレコードの先頭に3動させることにより、
ソート処理においてレコードの先頭で比較処理が行なえ
、もってソート処理装置におけるソート処理の高速化が
図れ、且つキーフィールドに先行するデータをバッファ
リングするためのメモリを不要にできるソート前処理装
置を提供することにある。
[Purpose of the Invention] This invention was made in view of the above circumstances, and its purpose is to perform preprocessing on records to be sorted and move a designated key field to the beginning of the record.
To provide a sort preprocessing device that can perform comparison processing at the head of a record in sorting processing, speed up the sorting processing in the sorting processing device, and eliminate the need for memory for buffering data preceding a key field. There is a particular thing.

段は、このメモリを、ソート処理において比較対比され
たデータ(即ち、その先頭に指定キーフィールドが移動
されたレコード)は、ソート処理対象データ(レコード
)としてソート処理装置に供給される。
The data that has been compared and contrasted in the sorting process (that is, the record in which the specified key field has been moved to the beginning) is supplied to the sorting processing device as data (record) to be sorted.

[発明の実施例] 第1図はこの発明の一実施例に係るソート前処理装置の
構成を示す。このソート前処理装置は、ソート処理装置
の入力側に置かれる。第1図において、11はソート処
理の対象となるルコード分のデータを一時格納するメモ
リ、12はメモリ11に接続されるデータ入力ライン、
13はメモリ11に接続されるデータ出力ラインである
。14はメモリ11に対する書込みアドレスWAを保持
するアドレスレジスタ、15はメモリ11に対する読出
しアドレスRAを保持するアドレスレジスタである。ア
ドレスレジスタ14. Isはカウンタ機能を有する。
[Embodiment of the Invention] FIG. 1 shows the configuration of a sorting preprocessing device according to an embodiment of the invention. This pre-sorting device is placed on the input side of the sorting device. In FIG. 1, 11 is a memory for temporarily storing data for the code to be sorted; 12 is a data input line connected to the memory 11;
13 is a data output line connected to the memory 11. 14 is an address register that holds a write address WA for the memory 11, and 15 is an address register that holds a read address RA for the memory 11. Address register 14. Is has a counter function.

16はメモリ11に対する読出し開始アドレスIAP)
と−1との加算を行なう加算器である。18はフサ、1
9はアドレスレジスタ14.15の各内容(WA、RA
)のいずれか一方を、メモリ11に対するアドレスとし
て選択するマルチプレクサである。
16 is the read start address IAP for the memory 11)
This is an adder that performs addition of and -1. 18 is Fusa, 1
9 is the contents of address registers 14 and 15 (WA, RA
) as the address for the memory 11.

20はソート処理の対象となるレコードのレコード長R
8Z (実際にはR3Z−1、単位はバイト)を保持す
るサイズレジスタ、21はアドレスレジスタ14および
サイズレジスタ20の各内容(WA、R8Z)を比較し
て一致を検出する比較器である。
20 is the record length R of the record to be sorted
8Z (actually R3Z-1, unit is byte); 21 is a comparator that compares the contents (WA, R8Z) of the address register 14 and size register 20 to detect a match.

22はアドレスレジスタ15およびサイズレジスタ20
の各内容(RA、R8Z)を比較して一致を検出する比
較器、23はアドレスレジスタ15および−1回路17
の各内容(RA、IAP−1)を比較して一致を検出す
る比較器、24は制御回路である。制御回路24は、比
較器21〜23からの一致検出信号に応じて、マルチプ
レクサ18.19の切換え制御、更には上位装置(図示
せず)への終了割込みなどを行なう。
22 is an address register 15 and a size register 20
23 is an address register 15 and a -1 circuit 17.
A comparator 24 is a control circuit that compares each content (RA, IAP-1) of the data and detects a match. The control circuit 24 controls the switching of the multiplexers 18 and 19 in response to the coincidence detection signals from the comparators 21 to 23, and further performs a termination interrupt to a host device (not shown).

、イヒにより、アドレスレジスタ14がクリアされ、■
1;−1 A’Pレジスタ16に読出し開始アドレスrAPがセッ
トされる。この読出し開始アドレスIAPには、ソート
対象となる各レコードにおける比較対象データ、即ちキ
ーフィールドの位置(レコード゛の先頭からのバイト位
置)を示す情報が用いられる。
, the address register 14 is cleared by
1;-1 The read start address rAP is set in the A'P register 16. This read start address IAP uses information indicating the data to be compared in each record to be sorted, that is, the position of the key field (byte position from the beginning of the record).

また、サイズレジスタ20に、ソート対象レコードのレ
コード長R8Zがセットされる。以上の初期化処理が行
なわれると、データ入力ライン12を介してソート対象
レコードがメモリー1に導h1れる。
Furthermore, the record length R8Z of the record to be sorted is set in the size register 20. When the above initialization processing is performed, records to be sorted are led to the memory 1 via the data input line 12 h1.

しかして、制御回路24の制御の下で、マルチプレクサ
19によりアドレスレジスター4.15のうちのアドレ
スレジスター4が選択され、アドレスレジスタ14から
の書込みアドレスWAに基づいて、メモ1ノ11への書
込み動作が行なわれる。アドレスレジスタ14は1バイ
ト書込みごとに+1され、これによりデータ入力ライン
12上のレコードが、メモリー1の「0」番地から始ま
る連続領域に1バイ1−11位すると、その旨を制御回
路24に通知する。制御口!1 ;路24は、メモリーに対するレコードの書込みモード
において、比較器21から一致が通知されると、−ルー
コードの最終バイトの書込みとなるものと¥J1断し、
そのサイクルの終了時に書込みモード力\ら    J
l+読出しモードに変更する。このとき、メモ1ノ11
のrOJ番地からrR8Z−IJ番地の領域(こ警よ、
第2図(a)に示すようにルコード分のデータが書込ま
れている。また、レコード中の(指定された)キーフィ
ールドの先頭バイトは、rIAPJ番地に書込まれてい
る。
Therefore, under the control of the control circuit 24, the multiplexer 19 selects address register 4 of the address registers 4.15, and based on the write address WA from the address register 14, a write operation to the memo 1 to 11 is performed. will be carried out. The address register 14 is incremented by 1 every time one byte is written, and when the record on the data input line 12 is placed one byte 1-11 in the continuous area starting from address "0" in memory 1, this fact is sent to the control circuit 24. Notice. Control port! 1; When a match is notified from the comparator 21 in the record write mode to the memory, the path 24 determines that the last byte of the -rou code is to be written;
Write mode force at the end of that cycle
Change to l+ read mode. At this time, memo 1 no. 11
The area from address rOJ to address rR8Z-IJ (O police,
As shown in FIG. 2(a), the data for the code is written. Furthermore, the first byte of the (specified) key field in the record is written to address rIAPJ.

制御回路24は、読出しモードにおいて、まずマルチプ
レクサ18を制御し、IAPレジスタ16からの読出し
開始アドレスIAP、または固定値゛0″(0番地を示
すアドレス)のうち、読出し開始アドレスIAPを選択
せしめ、同IAPをアドレスレジスタ15にセットする
。なお、この動作を、上記した初期化時に行なうことも
可能である。そして、制御回路24は、マルチプレクサ
19を制御して、メモリ11に対するアドレスを、アド
レスレジスタ3理装置(図示せず)に導かれる。
In the read mode, the control circuit 24 first controls the multiplexer 18 to select the read start address IAP from the read start address IAP from the IAP register 16 or the fixed value "0" (address indicating address 0), The same IAP is set in the address register 15. Note that this operation can also be performed at the time of the above-mentioned initialization.Then, the control circuit 24 controls the multiplexer 19 to set the address for the memory 11 in the address register 15. It is guided by a three-dimensional system (not shown).

ニー“11.比較器22.よ、アt’ L/2 L/、
:)、 915カ、ら、7)読出。
Knee "11. Comparator 22. At' L/2 L/,
:), 915 Ka, et al., 7) Read.

アドレスRAとサイズレジスタ20からのレコード。Records from address RA and size register 20.

長R8Zとを比較しており、RAがR8Zに一致すると
、その旨を制御回路24に通知する。制御回路24は、
メモリ11からのレコードの読出しモードにおいて比較
器22から一致が通知されると、ルーコードの最終バイ
トの読出しとなるものと判断し、マルチプレクサ18を
切換え制御する。そして、制御回路24は、マルチプレ
クサ18から新たに選択された固定値゛0゛′を、その
サイクルの終了時に、アドレスレジスタ15にセットせ
しめる。これにより、メモリ11に対する読出しアドレ
スRAはrOJ番地に戻り、メモリ11の「0」番地か
ら順に1バイト単位でデータが読出される。即ち、(キ
ーフィールドの先頭バイトから)レコードの最終バイト
までが読出されることが検出されると、次のすしている
。−1回路17からの出力値は、IAPし+!−’p:
スタ16の保持内容である読出し開始アドレス11: ′ APから1を減じたIAP−1である。比較器23
1.:。
The length R8Z is compared, and when RA matches R8Z, the control circuit 24 is notified of this fact. The control circuit 24 is
When a match is notified from the comparator 22 in the record read mode from the memory 11, it is determined that the last byte of the Lou code is to be read, and the multiplexer 18 is switched and controlled. Then, the control circuit 24 causes the address register 15 to be set to the newly selected fixed value "0" from the multiplexer 18 at the end of that cycle. As a result, the read address RA for the memory 11 returns to address rOJ, and data is read out in 1-byte units starting from address "0" in the memory 11. That is, when it is detected that the last byte of the record (from the first byte of the key field) is read, the next read is performed. The output value from the -1 circuit 17 is +! -'p:
The read start address 11, which is the content held in the star 16: 'IAP-1, which is obtained by subtracting 1 from AP. Comparator 23
1. :.

1・′1は、RAがIAP−1に一致したことを検出す
ると、その旨を制御回路24に通知する。制御回路24
は、メモリー1からのレコードの読出しモードにおいて
比較器23から一致が通知されると、キーフィールドの
直前バイトの読出しとなるものと判断し、次のサイクル
で上位装置にルーコードの処理終了を示す割込みを発し
、メモリー1からの読出しを停止する。そして、第1図
のソート前処理装置では、上位装置からの指示により、
次のルーコードについての前処理が再び行なわれる。
1.'1, upon detecting that RA matches IAP-1, notifies the control circuit 24 of this fact. Control circuit 24
When a match is notified from the comparator 23 in the mode of reading records from memory 1, it determines that the byte immediately before the key field is to be read, and in the next cycle it indicates to the host device that processing of the roux code has ended. Issues an interrupt and stops reading from memory 1. Then, in the sort preprocessing device shown in FIG. 1, according to instructions from the higher-level device,
The preprocessing for the next roux code is performed again.

上記したように、第1図のソート前処理装置では、ソー
ト処理対象レコードを−Hメモリー1に書込んだ後、I
APで示されるバイト位置からレコードエンドまでのデ
ータ、即ちソート処理対象レコード中の指定されたキー
フィールドの先頭バイトから同レコードの最終バイトま
でが、1バイ1〜単位で読出し出力され、次に残りのデ
ータ、即ち移動されたソート処理対象レコードが供給さ
れる。
As described above, in the sort preprocessing device shown in FIG.
The data from the byte position indicated by AP to the end of the record, that is, from the first byte of the specified key field in the record to be sorted to the last byte of the record, is read and output in units of 1 byte, and then the remaining data is read out. data, that is, the moved records to be sorted are supplied.

下、゛こ− °パなお、前記実施例では、まずキーフィールドの仝←
バイトからレコードの最終バイトまでを読出!じ、;次
にレコードの先頭バイトからキーフィールドの直前バイ
トまでを読出す場合について説明したが、これに限るも
のではない。例えば、まずキーフィールドを読出し、次
にレコードの先頭バイトからキーフィールドの直前バイ
トまでを読出し、最後にキーフィールドの次のバイトか
らレコードの最終バイトまでを読出すようにしてもよく
、要はキーフィールドがレコード先頭に移動されるよう
に処理が施されればよい。但し、この場合には、指定キ
ーフィールドのフィールド長VDLを保持するレジスタ
、このレジスタの内容と読出しアドレスRAとによりキ
ーフィールドの最終バイトが読出されることを検出する
手段、更にはキーフィールドの次のバイトからの読出し
に際し、IAP+VDLを読出しアドレスRAとして設
定する手段等が必要となる。
Note that in the above example, the key field first is ←
Read from the byte to the last byte of the record! Next, the case of reading from the first byte of the record to the byte immediately before the key field has been described, but the present invention is not limited to this. For example, you may first read the key field, then read from the first byte of the record to the byte immediately before the key field, and finally read from the next byte of the key field to the last byte of the record. Processing may be performed so that the field is moved to the beginning of the record. However, in this case, a register that holds the field length VDL of the specified key field, a means for detecting that the last byte of the key field is read based on the contents of this register and the read address RA, and furthermore, When reading from the byte, a means for setting IAP+VDL as the read address RA is required.

[発明の効果] 以上詳述したようにこの発明によれば、ソート処理装置
に供給することにより、ソート処理装置では、キーフィ
ールドの比較結果をいちはやく確定できるので、ソート
処理速度が向上する。また、キーフィールドがレコード
の先頭にあることから、従来のようにキーフィールドが
到来するまで(比較対象とならない)データを保持する
必要がなく、したがってそのためのバッファメモリなど
が不要となる。なお、2111のレコード間でのキーフ
ィールドの比較は、その先頭から所定バイト単位で比較
結果が確定するまで行なわれるが、値が等しいときは2
個のレコードのいずれの比較データを出力してもよいの
で、一致判定された比較済みデータを比較結果が確定す
るまで保持しておく必要がない。したがって、ソート処
理装置において上記したバッフ7メモリを持たない場合
の不都合はない。
[Effects of the Invention] As described in detail above, according to the present invention, by supplying the information to the sorting processing device, the sorting processing device can quickly determine the comparison results of the key fields, thereby improving the sorting processing speed. Furthermore, since the key field is located at the beginning of the record, there is no need to hold data (not to be compared) until the key field arrives, as in the past, and therefore no buffer memory or the like is required. Note that the comparison of key fields between 2111 records is performed in predetermined byte units from the beginning until the comparison result is finalized, but when the values are equal, 2
Since comparison data from any of the records may be output, there is no need to hold the compared data for which a match has been determined until the comparison result is finalized. Therefore, there is no problem when the sort processing device does not have the buffer 7 memory described above.

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

第1図はこの発明の一実施例に係るソート前処理装置の
ブロック構成因、第2図は第1図の装置の動作を説明す
る図である。 11・・・メモリ、14.15・・・アドレスレジスタ
、16・・・IAPレジスタ、20・・・サイズレジス
タ、18.19・・・マルチプレクサ、21〜23・・
・比較器、24・・・制御回路。
FIG. 1 is a block diagram of a pre-sorting device according to an embodiment of the present invention, and FIG. 2 is a diagram illustrating the operation of the device shown in FIG. 11...Memory, 14.15...Address register, 16...IAP register, 20...Size register, 18.19...Multiplexer, 21-23...
- Comparator, 24... control circuit.

Claims (1)

【特許請求の範囲】[Claims] ソート処理の対象となる1レコード分のデータを所定ア
ドレスから始まる連続領域に格納するメモリと、このメ
モリを、ソート処理において比較対象となる指定キーフ
ィールドの先頭位置に対応するアドレスから順にリード
アクセスして上記キーフィールドを読出す第1読出し手
段と、上記メモリ内の残りデータを読出す第2読出し手
段とを具備し、上記メモリから読出されるデータをソー
ト処理対象データとしてソート処理装置に供給すること
を特徴とするソート前処理装置。
A memory that stores one record's worth of data to be sorted in a continuous area starting from a predetermined address, and a read access to this memory in order from the address corresponding to the start position of the specified key field to be compared in sorting. and a second reading means for reading the remaining data in the memory, and supplies the data read from the memory to a sorting processing device as data to be sorted. A sorting preprocessing device characterized by:
JP18373684A 1984-09-04 1984-09-04 Sort preprocessor Pending JPS6162134A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP18373684A JPS6162134A (en) 1984-09-04 1984-09-04 Sort preprocessor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP18373684A JPS6162134A (en) 1984-09-04 1984-09-04 Sort preprocessor

Publications (1)

Publication Number Publication Date
JPS6162134A true JPS6162134A (en) 1986-03-31

Family

ID=16141071

Family Applications (1)

Application Number Title Priority Date Filing Date
JP18373684A Pending JPS6162134A (en) 1984-09-04 1984-09-04 Sort preprocessor

Country Status (1)

Country Link
JP (1) JPS6162134A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5945546A (en) * 1982-08-23 1984-03-14 カネヴァリィ・ティムバ−・カンパニ− Method and system for handling a plurality of data record according to key field value

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5945546A (en) * 1982-08-23 1984-03-14 カネヴァリィ・ティムバ−・カンパニ− Method and system for handling a plurality of data record according to key field value

Similar Documents

Publication Publication Date Title
US4476525A (en) Pipeline-controlled data processing system capable of performing a plurality of instructions simultaneously
EP0155211B1 (en) System for by-pass control in pipeline operation of computer
KR970011208B1 (en) Pipelined register cache
US5187783A (en) Controller for direct memory access
US3289171A (en) Push-down list storage using delay line
US2853698A (en) Compression system
JPS6162134A (en) Sort preprocessor
US2925588A (en) Memory reading system
JPS54150049A (en) Pre-fetch order control system
JPH0833812B2 (en) Sorting device
SU826340A1 (en) Device for sorting mn-digit numbers
SU1341636A1 (en) Program interruption device
SU1007099A1 (en) Number sorting device
RU2058583C1 (en) Device for sorting information
SU1476434A1 (en) Program control device for process equipment
JP2923869B2 (en) Event input circuit
WO1987004829A1 (en) Improvements relating to control flow in computers
JPH0433059B2 (en)
JPS562048A (en) Sequence decision system of control memory
JPH07193561A (en) System and device for synchronously processing format
JPH0683580A (en) Buffer memory
JPH048815B2 (en)
JPS5652445A (en) Information processing system
JPH0298755A (en) Cache nullification processing system
JPH0792902A (en) Programmable controller