JPH0145648B2 - - Google Patents

Info

Publication number
JPH0145648B2
JPH0145648B2 JP16784580A JP16784580A JPH0145648B2 JP H0145648 B2 JPH0145648 B2 JP H0145648B2 JP 16784580 A JP16784580 A JP 16784580A JP 16784580 A JP16784580 A JP 16784580A JP H0145648 B2 JPH0145648 B2 JP H0145648B2
Authority
JP
Japan
Prior art keywords
block
file
main memory
sorted
stored
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
Application number
JP16784580A
Other languages
Japanese (ja)
Other versions
JPS5790757A (en
Inventor
Makoto Okada
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP16784580A priority Critical patent/JPS5790757A/en
Publication of JPS5790757A publication Critical patent/JPS5790757A/en
Publication of JPH0145648B2 publication Critical patent/JPH0145648B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/22Arrangements for sorting or merging computer data on continuous record carriers, e.g. tape, drum, disc
    • G06F7/36Combined merging and sorting

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)

Description

【発明の詳細な説明】 本発明は、ソート・マージの対象となるレコー
ド群を複数のブロツクに分け、各ブロツクを代表
する代表キーを求め、これらの代表キーを用いて
ソート・マージを行うようにしたソート・マージ
処理方式に関するものである。
[Detailed Description of the Invention] The present invention divides a group of records to be sorted and merged into a plurality of blocks, obtains representative keys representing each block, and performs sorting and merging using these representative keys. This is related to the sort/merge processing method.

第1図は従来のソート・マージ処理方式を示す
ものであつて、Rは入力データ・レコード群、γ
は入力データ・レコード、STはストリングをそ
れぞれ示している。従来のソート・マージ処理方
式においては、先ず第1図イに示すように入力デ
ータ・レコード群Rをソート処理して複数のスト
リングSTに分割する。次に、第1図ロに示すよ
うに、これらのストリングSTをマージ処理して
より長い複数のストリングSTを作成する。これ
らのマージ処理を繰返して2本のストリングST
が作出されると、第1図ハに示すようにこれら2
本のストリングをマージ処理して1本のストリン
グを作り出す。
FIG. 1 shows a conventional sort/merge processing method, where R is a group of input data records, γ
indicates an input data record, and ST indicates a string. In the conventional sort/merge processing method, first, as shown in FIG. 1A, the input data record group R is sorted and divided into a plurality of strings ST. Next, as shown in FIG. 1B, these strings ST are merged to create a plurality of longer strings ST. By repeating these merging processes, two strings ST
are created, these two
Create a single string by merging book strings.

通常、第1図イのソート処理で作り出されるス
トリングは直接アクセス記憶装置などの外部記憶
装置上に置かれ、その本数は入力データ・レコー
ドの件数と並べ換えに使用できる主記憶量との関
係で定まる。第1図ロのようにストリングをマー
ジするために、外部記憶装置と主記憶装置間のデ
ータの移動が行われ、データ移動の総量(アクセ
ス量)は第1図イで作成されたストリングの本数
と上記の主記憶量との関係で決定される。外部記
憶装置へのアクセスは主記憶へのアクセスに比べ
て非常に遅いので、ソート・マージ処理の処理速
度は外部記憶装置へのアクセス量(アクセス回
数)によつて殆んど決定される。
Normally, the strings created by the sorting process shown in FIG. In order to merge strings as shown in Figure 1B, data is moved between the external storage device and the main memory, and the total amount of data movement (access amount) is the number of strings created in Figure 1B. It is determined based on the relationship between the amount of memory and the amount of main memory described above. Since access to the external storage device is much slower than access to the main memory, the processing speed of the sort/merge process is mostly determined by the amount of accesses (number of accesses) to the external storage device.

本発明は、上記の考察に基づくものであつて外
部記憶装置へのアクセス量を減少でき、これによ
つてソート・マージ処理の処理速度を向上できる
ようにしたソート・マージ処理方式を提供するこ
とを目的としている。そしてそのため、本発明の
ソート・マージ処理方式は、 入力フアイルに格納されている入力データ・レ
コード群を、処理装置、主記憶、直接アクセス記
憶装置上の作業フアイルを有する計算機でソー
ト・マージ処理し、ソート・マージされたデー
タ・レコードの列を出力フアイルに格納するソー
ト・マージ処理方式において、 (a) 上記入力フアイルに格納れている入力デー
タ・レコード群を順次に上記主記憶に読込み、
上記処理装置で以て処理することにより、上記
入力データ・レコード群を、データ・レコード
の集合である所の複数のブロツクに分割して上
記作業フアイルに格納すると共に、各ブロツク
毎に昇順もしくは降順に従い代表キーを選択
し、作業フアイル上のブロツクのアドレスと当
該ブロツクの代表キーで以てブロツク毎の付属
情報を作成し、作成された付属情報の集合を上
記作業フアイルに格納し、 (b) 作業フアイル上の付属情報の集合を上記主記
憶に読込み、上記処理装置で以て代表キーに従
つてソート処理し、ソート処理された付属情報
の列を上記作業フアイルに格納し、 (c) ソート処理された付属情報の列に従い、上記
作業フアイルよりブロツクを上記主記憶に読込
み、該ブロツクから主記憶上にデータ・レコー
ド列を生成し、次に読込まれた代表キーに基づ
いて上記データ・レコード列を2分し、2個の
部分列の内の所定の部分列を上記出力フアイル
に格納し、残された部分列と次に読込まれたブ
ロツクのデータ・レコードとをマージして、新
たなレコードとして主記憶上に生成する ことを特徴とするものである。以下、本発明を図
面を参照しつつ説明する。
The present invention is based on the above considerations, and provides a sort/merge processing method that can reduce the amount of access to an external storage device and thereby improve the processing speed of sort/merge processing. It is an object. Therefore, the sort/merge processing method of the present invention involves sorting/merging a group of input data records stored in an input file using a computer having a processing device, a main memory, and a work file on a direct access storage device. In a sort/merge processing method that stores sorted/merged data record columns in an output file, (a) sequentially reads a group of input data records stored in the input file into the main memory;
By processing with the processing device, the input data record group is divided into a plurality of blocks, each of which is a set of data records, and stored in the work file, and each block is sorted in ascending or descending order. Select a representative key according to the above, create attached information for each block using the address of the block on the work file and the representative key of the block, store the set of created attached information in the work file, (b) A set of attached information on the work file is read into the main memory, sorted by the processing device according to the representative key, and the sorted column of attached information is stored in the work file, (c) sorting. According to the processed attribute information column, a block is read from the work file into the main memory, a data record string is generated from the block on the main memory, and then the data record is generated based on the read representative key. Divide the column into two, store a predetermined subsequence of the two subsequences in the above output file, merge the remaining subsequence with the data record of the next read block, and create a new block. It is characterized by being generated on the main memory as a record. Hereinafter, the present invention will be explained with reference to the drawings.

第2図イ,ロ,ハは本発明のソート・マージ処
理方式の1例を説明する図、第3図は本発明を実
施するために必要な機器構成を示す図である。
FIGS. 2A, 2B, and 2C are diagrams for explaining an example of the sort/merge processing method of the present invention, and FIG. 3 is a diagram showing the equipment configuration necessary for implementing the present invention.

第2図および第3図において、Bはブロツク、
AIは付属情報、1は入力フアイル、2は処理装
置、3は主記憶、4は作業フアイル、5は出力フ
アイルをそれぞれ示している。
In Figures 2 and 3, B is a block;
AI indicates attached information, 1 indicates an input file, 2 indicates a processing device, 3 indicates a main memory, 4 indicates a work file, and 5 indicates an output file.

従来のソート・マージ処理方式においては、マ
ージ処理はストリング単位で行われるが、本発明
においては各ストリングを構成するブロツク単位
にマージ処理を行う。処理手順は下記の通りであ
る。
In the conventional sort/merge processing method, merging processing is performed in units of strings, but in the present invention, merging processing is performed in units of blocks constituting each string. The processing procedure is as follows.

入力データ・レコード群Rは入力フアイル1に
格納されているが、第2図イに示すように入力デ
ータ・レコード群Rを主記憶3上に順次読込んで
処理装置2でソート処理、ブロツク化処理および
付属情報作成処理を行い、その結果を作業フアイ
ル4に格納する。ソート処理とは複数のストリン
グを作成する処理であり、ブロツク処理とは各ス
トリングSTを複数のブロツクBに分割する処理
である。ブロツクとは主記憶装置と外部記憶装置
との間におけるデータ転送の単位である。付加情
報作成処理とは、各ブロツクB毎に、代表キーお
よびそのブロツクの作業フアイル4のアドレスよ
り成る付加情報AIを作成し、その付加情報AIの
作業フアイルに書込む処理である。代表キーとし
ては、そのブロツクに属するレコードのキーのう
ち最も大きいもの或は最も小さいものが代表キー
として選択される。
The input data record group R is stored in the input file 1, and as shown in FIG. and additional information creation processing, and the results are stored in the work file 4. Sorting processing is processing for creating a plurality of strings, and block processing is processing for dividing each string ST into a plurality of blocks B. A block is a unit of data transfer between the main storage and external storage. The additional information creation process is a process of creating additional information AI consisting of a representative key and the address of the work file 4 of that block for each block B, and writing it into the work file of the additional information AI. The largest or smallest of the keys of records belonging to the block is selected as the representative key.

第2図イのソート処理、ブロツク化処理および
付属情報作成処理が行われた後、第2図ロに示す
ように、作業フアイル4より付属情報AIの集合
を主メモリ3上に読込み、代表キーに従つてソー
ト処理を行い、付属情報AIのストリングを作成
し、これを再び作業フアイル4に書込む。
After the sorting process, blocking process, and attached information creation process shown in Fig. 2A are performed, as shown in Fig. 2B, the set of attached information AI is read into the main memory 3 from the work file 4, and the representative key Sort processing is performed according to , a string of attached information AI is created, and this is written to the work file 4 again.

第2図ロのソート処理を行つて付属情報ストリ
ングを作成した後、付加情報AIのストリングに
従い、作業フアイル4上のブロツクBを順次に主
記憶3に読込み、マージ処理を施し、主記憶3上
にデータ・レコードγのストリングを作成する。
主記憶3の内のストリングを、作業フアイル4に
残つている付属情報のストリングのおける先頭の
付属情報の代表キーを用いて2つの部分に分け
る。一方は上記の代表キーより前にあるキーをも
つデータ・レコードのストリングであり、他方は
後方のデータ・レコードのストリングとなる。前
者は直ちに出力レコードとして主記憶3より追出
され、出力フアイル5に格納される。出力フアイ
ル5にデータ・レコードのストリングを格納した
後、主記憶3に後続ブロツクBを作業フアイル4
から読込み可能であれば、後続のブロツクBを読
込み、上記のようなマージ処理を行う。主記憶3
に後続のブロツクBを読込むスペースが存在しな
い場合には、後方のデータ・レコードのストリン
グ中で不必要なレコードを作業フアイル4に書戻
すことにより空きスペースを確保する。この場
合、作業フアイル4へ書戻されるブロツクに対
し、第2図イのようにして付属情報を作成し、こ
の作成した付属情報を第2図ロのように作成され
た付属情報のストリングの中の正しい位置に挿入
する。書戻されたブロツクをも含め、作業フアイ
ル4上に存在する全てのブロツクをマージし、出
力レコード列とした時点で処理は完了する。
After creating an attached information string by performing the sorting process shown in FIG. Create a string of data records γ in .
The string in the main memory 3 is divided into two parts using the representative key of the first attached information in the string of attached information remaining in the work file 4. One is a string of data records with keys before the representative key, and the other is a string of data records after. The former is immediately removed from the main memory 3 as an output record and stored in the output file 5. After storing the string of data records in the output file 5, the subsequent block B is stored in the main memory 3 as a work file 4.
If it is possible to read from block B, the subsequent block B is read and the merge process as described above is performed. Main memory 3
If there is no space to read the subsequent block B, empty space is secured by writing unnecessary records in the string of subsequent data records back to the work file 4. In this case, for the block to be written back to the work file 4, the attached information is created as shown in Figure 2 A, and the created attached information is inserted into the created attached information string as shown in Figure 2 B. Insert it in the correct position. The process is completed when all blocks existing on the work file 4, including the blocks written back, are merged to form an output record string.

以上の説明から明らかなように、本発明のソー
ト・マージ処理方式によれば、ソート・マージ処
理を効率的に処理することが出来る。従来方式に
おいては、入力データ・レコードの順序が殆んど
揃つているような場合でも、揃つていない場合と
略ぼ同様な処理時間を必要としたが、本発明のソ
ート・マージ処理方式によれば、入力データ・レ
コードの順序が略ぼ揃つているような場合には非
常に短時間で処理を終了することが出来る。
As is clear from the above description, according to the sort/merge processing method of the present invention, sort/merge processing can be efficiently processed. In the conventional method, almost the same processing time was required even when the input data records were almost in the same order as when they were not, but the sort/merge processing method of the present invention requires approximately the same processing time. According to this method, when the input data records are almost in the same order, processing can be completed in a very short time.

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

第1図は従来のソート・マージ処理方式を示す
図、第2図は本発明のソート・マージ処理方式の
1例を説明する図、第3図は本発明を実施するた
めに必要な機器構成を示す図である。 R……入力データ・レコード群、γ……入力デ
ータ・レコード、ST……ストリング、B……ブ
ロツク、AI……付属情報、1……入力フアイル、
2……処理装置、3……主記憶、4……作業フア
イル、5……出力フアイル。
Fig. 1 is a diagram showing a conventional sort/merge processing method, Fig. 2 is a diagram illustrating an example of the sort/merge processing method of the present invention, and Fig. 3 is a diagram showing the equipment configuration necessary to implement the present invention. FIG. R...Input data record group, γ...Input data record, ST...String, B...Block, AI...attached information, 1...Input file,
2... Processing device, 3... Main memory, 4... Work file, 5... Output file.

Claims (1)

【特許請求の範囲】 1 入力フアイルに格納されている入力データ・
レコード群を、処理装置、主記憶、直接アクセス
記憶装置上の作業フアイルを有する計算機でソー
ト・マージ処理し、ソート・マージされたデー
タ・レコードの列を出力フアイルに格納するソー
ト・マージ処理方式において、 (a) 上記入力フアイルに格納されている入力デー
タ・レコード群を順次に上記主記憶に読込み、
上記処理装置で以て処理することにより、上記
入力データ・レコード群を、データ・レコード
の集合である所の複数のブロツクに分割して上
記作業フアイルに格納すると共に、各ブロツク
毎に昇順もしくは降順に従い代表キーを選択
し、作業フアイル上のブロツクのアドレスと当
該ブロツクの代表キーで以てブロツク毎の付属
情報を作成し、作成された付属情報の集合を上
記作業フアイルに格納し、 (b) 作業フアイル上の付属情報の集合を上記主記
憶に読込み、上記処理装置で以て代表キーに従
つてソート処理し、ソート処理された付属情報
の列を上記作業フアイルに格納し、 (c) ソート処理された付属情報の列に従い、上記
作業フアイルよりブロツクを上記主記憶に読込
み、該ブロツクから主記憶上にデータ・レコー
ド列を生成し、次に読込まれた代表キーに基づ
いて上記データ・レコード列を2分し、2個の
部分列の内の所定の部分列を上記出力フアイル
に格納し、残された部分列と次に読込まれたブ
ロツクのデータ・レコードとをマージして、新
たなレコードとして主記憶上に生成する ことを特徴とするソート・マージ処理方式。
[Claims] 1. Input data stored in the input file.
A sort/merge processing method in which a group of records is sorted and merged by a computer having work files on a processing unit, main memory, and direct access storage, and the sorted and merged columns of data records are stored in an output file. (a) Sequentially read the input data record group stored in the input file into the main memory,
By processing with the processing device, the input data record group is divided into a plurality of blocks, each of which is a set of data records, and stored in the work file, and each block is sorted in ascending or descending order. Select a representative key according to the above, create attached information for each block using the address of the block on the work file and the representative key of the block, store the set of created attached information in the work file, (b) A set of attached information on the work file is read into the main memory, sorted by the processing device according to the representative key, and the sorted column of attached information is stored in the work file, (c) sorting. According to the processed attribute information column, a block is read from the work file into the main memory, a data record string is generated from the block on the main memory, and then the data record is generated based on the read representative key. Divide the column into two, store a predetermined subsequence of the two subsequences in the above output file, merge the remaining subsequence with the data record of the next read block, and create a new block. A sort/merge processing method characterized by generating records on main memory.
JP16784580A 1980-11-28 1980-11-28 Sort-merge process system Granted JPS5790757A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16784580A JPS5790757A (en) 1980-11-28 1980-11-28 Sort-merge process system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16784580A JPS5790757A (en) 1980-11-28 1980-11-28 Sort-merge process system

Publications (2)

Publication Number Publication Date
JPS5790757A JPS5790757A (en) 1982-06-05
JPH0145648B2 true JPH0145648B2 (en) 1989-10-04

Family

ID=15857146

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16784580A Granted JPS5790757A (en) 1980-11-28 1980-11-28 Sort-merge process system

Country Status (1)

Country Link
JP (1) JPS5790757A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0782426B2 (en) * 1984-08-22 1995-09-06 株式会社日立製作所 Merge sort method and apparatus

Also Published As

Publication number Publication date
JPS5790757A (en) 1982-06-05

Similar Documents

Publication Publication Date Title
US5117495A (en) Method of sorting data records
US5293616A (en) Method and apparatus for representing and interrogating an index in a digital memory
EP0487331B1 (en) Directory management system
JPH02178730A (en) Internal sorting system using dividing method
JP3515810B2 (en) Sort processing method and apparatus
JPH0145648B2 (en)
JPH0782429B2 (en) How to merge multiple files
JP2586610B2 (en) File creation method
JPS62287350A (en) Index integrally updating system
JP2669241B2 (en) Migration processing method
JP2604787B2 (en) Two-dimensional data storage method
JP3047400B2 (en) Data processing device
JPH048816B2 (en)
JPH07101382B2 (en) Margin processing device
JPH03202934A (en) Data processor
JP2507399B2 (en) Database equipment
JP2788849B2 (en) Grouping method by serial number description
JPS6143339A (en) Searching of association matrix
JPH0275018A (en) Merge processing method
JP3456481B2 (en) Information processing device
JP2605476B2 (en) Dump collection processing method
JPS626255B2 (en)
JPH02216554A (en) System for reforming index order forming file
JPH01147720A (en) Classification processing system
JPH07120303B2 (en) Data base file restoration method