[go: up one dir, main page]

JPH023870A - Method for retrieving record of relational data base - Google Patents

Method for retrieving record of relational data base

Info

Publication number
JPH023870A
JPH023870A JP63152048A JP15204888A JPH023870A JP H023870 A JPH023870 A JP H023870A JP 63152048 A JP63152048 A JP 63152048A JP 15204888 A JP15204888 A JP 15204888A JP H023870 A JPH023870 A JP H023870A
Authority
JP
Japan
Prior art keywords
join
records
search
processing
condition
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
JP63152048A
Other languages
Japanese (ja)
Inventor
Takashi Horiuchi
孝 堀内
Yukihisa Tsuchiya
土谷 往久
Jinnosuke Nakamura
中村 仁之輔
Ichiro Itakura
板倉 一郎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
NTT Inc
Original Assignee
Hitachi Ltd
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd, Nippon Telegraph and Telephone Corp filed Critical Hitachi Ltd
Priority to JP63152048A priority Critical patent/JPH023870A/en
Publication of JPH023870A publication Critical patent/JPH023870A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To improve join processing performance by extracting the contents of a join field from a first table, and setting up a retrieving condition in a second table, and retrieving a record to agree with this condition, and generating a third table, and join-processing the first and the third tables. CONSTITUTION:The contents of the join field is extracted from a first table T1' retrieved before, and the extracted contents of the join field is added to the retrieving condition of a second table T2, and a new retrieving condition is set up, and only the record to agree with the retrieving condition is extracted from the second table of a relational data base on this retrieving condition, and a third table T2' is generated. Join processing is performed by considering the records of the first and the third tables to be objects. At this time, since all the records in the third table consist of the object records of join, unnecessary processing for the record with no possibility of the join can be excluded. Thus, the performance of the join processing can be improved.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明はリレーショナル・データベースに係り、特にジ
ョイン処理に好適なレコード検索方法に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to relational databases, and particularly to a record search method suitable for join processing.

〔従来の技術〕[Conventional technology]

リレーショナル・データベースの検索処理の一つにジョ
イン処理がある。これは複数のテーブルのレコードにつ
いて、共通の属性情報を持ったフィールドを手掛りに、
ジョイン条件に従って該当レコードを結合し、新しいレ
コードを作成する処理である。
One of the search processes in relational databases is join processing. This is based on fields that have common attribute information for records in multiple tables.
This is a process that combines corresponding records according to join conditions and creates a new record.

第2図のモデルを例にジョイン処理の概要を説明する。An overview of the join process will be explained using the model in FIG. 2 as an example.

第2図では、補助記憶上に2つのテーブルTl、T2が
格納されているとしている。これについて、次の様な検
索コマンド(SQL文)による検索要求があるとする。
In FIG. 2, it is assumed that two tables Tl and T2 are stored on the auxiliary storage. Regarding this, let us assume that there is a search request using the following search command (SQL statement).

5ELECT  C12,CC2 3FROTl、T2 WHERE   C11=C21ANDC1l≧20 このコマンドの意味は、「2つのテーブルTl。5ELECT C12, CC2 3FROTl, T2 WHERE C11=C21ANDC1l≧20 The meaning of this command is "Two tables Tl.

T2から、条件(C11=C2L  AND 011≧
20を満たすレコードを選び出し、フィールドC12,
C23を出力せよ」というものである。
From T2, the condition (C11=C2L AND 011≧
Select the record that satisfies 20, field C12,
"Output C23."

この検索要求に対し1次の(1)〜(3)の処理を行う
The primary processes (1) to (3) are performed for this search request.

(1)補助記憶上のテーブルTl、T2を主記憶に読み
込む、このとき、T1については選択条件C1l≧20
を満たすレコードのみを読み込む。
(1) Read tables Tl and T2 on auxiliary memory into main memory, at this time, selection condition C1l≧20 for T1
Read only records that meet the criteria.

T2については選択条件がないので、全レコードを読み
込む。
Since there is no selection condition for T2, all records are read.

(2)主記憶に読み込んだテーブルTl’ 、T2’に
ついて、ジョイン条件に従ってジョイン処理を行う(ソ
ート処理、レコード比較)。
(2) Perform join processing on tables Tl' and T2' read into the main memory according to join conditions (sort processing, record comparison).

(3)ジョイン処理の結果に対して、テーブルT3を作
成し、フィールドC12,C23のみを出力する。
(3) Create table T3 based on the result of the join process and output only fields C12 and C23.

二へで、(2)のジ道イン処理においては、テーブルT
l’ 、T2jのレコード数は一般に多く。
In the second step (2), table T
The number of records for l' and T2j is generally large.

ジョイン処理の効率上のネックとなっている。This is a bottleneck in the efficiency of join processing.

従来、このジョイン処理の効率を向上させる方法として
、特開昭57−105035号公報に記載のように、ジ
ョイン・フィールドの最大値と最小値を求め、その2値
の範囲にレコードを絞ってジョイン処理を行う方法(以
下、第1の従来方法という)、あるいは特開昭59−6
0659号公報の記載のように、ジョイン条件と検索条
件に指定されたフィールドが同一の場合、これから新し
い検索条件を作り出し、この条件でレコードを絞ってジ
ョイン処理を行う方法(以下、第2の従来方法という)
などが知られている。これらを第2図の場合に適用する
と次のようになる。第1の従来方法では、テーブルTl
’ 、T2’のジョイン・フィールドの最小値、最大値
を調べ、ジョイン範囲を限定する。その結果、ジョイン
範囲は20以上、30以下となり、テーブルT2’のジ
ョイン対象レコード数は、50件から11件に減少する
。また、第2の従来方法では、シミイン条件C11=C
21と選択条件C1l≧20に着目し、C21≧20と
いう条件を作り出し、テーブルT2の選択条件とする。
Conventionally, as a method to improve the efficiency of this join process, as described in Japanese Patent Laid-Open No. 57-105035, the maximum and minimum values of the join field are found, and the records are narrowed down to the range of these two values and joined. processing method (hereinafter referred to as the first conventional method), or JP-A-59-6
As described in Publication No. 0659, when the fields specified in the join condition and the search condition are the same, a new search condition is created from this, and the records are narrowed down using this condition and the join process is performed (hereinafter, the second conventional method). method)
etc. are known. Applying these to the case of FIG. 2 results in the following. In the first conventional method, the table Tl
Check the minimum and maximum values of the join fields of ', T2' and limit the join range. As a result, the join range becomes 20 or more and 30 or less, and the number of records to be joined in table T2' decreases from 50 to 11. Furthermore, in the second conventional method, the stain-in condition C11=C
21 and the selection condition C1l≧20, the condition C21≧20 is created and is set as the selection condition of table T2.

これにより、テーブルT2’のレコード数は50件から
31件に減少する。
As a result, the number of records in table T2' is reduced from 50 to 31.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

上記従来技術は、ジョイン処理の範囲を限定した中にも
、シミインの可能性がないレコードが存在している点に
ついて配慮がされておらず、ジョインの可能性がないレ
コードも含めたソート処理。
The above-mentioned conventional technology does not take into consideration the fact that there are records that have no possibility of simi-in even when the range of join processing is limited, and the sorting process includes records that have no possibility of joining.

ジョインの可能性がないレコードとの比較処理等も行っ
ていた為、ジョイン処理の性能向上には限界があった。
Since comparison processing was also performed with records that had no possibility of joining, there was a limit to the performance improvement of join processing.

さらに、第2の従来方法においては、ジョイン条件に指
定されたフィールドと同一のフィールドを使った検索条
件が検索コマンドに指定されていなければ、レコードの
絞込みは行えない問題があった。
Furthermore, in the second conventional method, there is a problem in that records cannot be narrowed down unless a search condition using the same field as the field specified in the join condition is specified in the search command.

本発明の目的は、リレーショナル・データベースのレコ
ード検索において、ジョイン処理対象テーブルのレコー
ドをデータベース中から検索する際、ジョインの可能性
がないレコードを取り除くことによって、ジョイン処理
の性能を更に向上せしめることにある。
An object of the present invention is to further improve the performance of join processing by removing records that have no possibility of joining when searching the database for records of tables to be joined in relational database record searches. be.

〔課題を解決するための手段〕[Means to solve the problem]

本発明のリレーショナル・データベース・レコード検索
方法は、複数個のテーブルをシミイン・フィールドにも
とづいてジョインし、ジョイン条件に合致したレコード
を組として抽出する際、検索条件により既に検索済の第
1のテーブルからジョイン・フィールドの内容を抽出し
、該抽出した内容を第2のテーブルの検索条件に付加し
て新たに検索条件を組立て、該検索条件に合致するレコ
ードを第2のテーブルから検索して第3のテーブルを生
成し、第1および第3のテーブルを対象にジョイン処理
を行うことを特徴とするものである。
In the relational database record search method of the present invention, when joining a plurality of tables based on a symin field and extracting records that meet the join conditions as a set, a first table that has already been searched based on the search conditions is searched. Extract the content of the join field from , add the extracted content to the search conditions in the second table to create a new search condition, search the second table for records that match the search conditions, and search the second table for records that match the search conditions. This method is characterized in that it generates three tables and performs join processing on the first and third tables.

〔作 用〕[For production]

まず、既に検索済の第1のテーブル(Tl’)からジョ
イン・フィールドの内容を抽出する0次に、この抽出し
たジョイン・フィールドの内容を。
First, the content of the join field is extracted from the already searched first table (Tl'). Next, the content of the extracted join field is extracted.

第2のテーブル(T2)の検索条件に付加して。In addition to the search conditions of the second table (T2).

新しい検索条件を組立て、この検索条件で、リレ−ショ
ナル・データベースの第2のテーブルから該検索条件に
合致したレコードのみ取り出し、第3のテーブル(T2
’)を生成する。ジョイン処理は、第1のテーブル及び
第3のテーブルのレコードを対象に行う、この時、第3
のテーブル中のレコードは全てジョイン対象レコードか
ら成るので、ジョインの可能性のないレコードに対する
不要な処理を排除でき、ジョイン処理の性能を向上出来
る。
Create a new search condition, use this search condition to retrieve only the records that match the search condition from the second table of the relational database, and retrieve the records that match the search condition from the third table (T2).
'). The join processing is performed on the records of the first table and the third table.
Since the records in the table are all records to be joined, unnecessary processing for records that have no possibility of being joined can be eliminated, and the performance of join processing can be improved.

第2図の例の場合1本発明では、ジョイン条件C11=
C12に看目し、この条件を満たすレコードのみをテー
ブルT2より選択する。この場合、テーブルTl’のC
1lには、20,25.30という値が選択液なので、
(C21=20 0RC21=25 0RC21=30
)という条件を作り出し、テーブルT2の選択条件(検
索条件)とする。これにより、検索されたテーブルT2
’のレコード数は50件から3件に減少し、従来方法に
比べてジ3イン処理の効率がはるかに向上することがわ
かる。
In case 1 of the example shown in FIG. 2, in the present invention, join condition C11=
Look at C12 and select only records that satisfy this condition from table T2. In this case, C of table Tl'
For 1 liter, the values 20, 25.30 are selective liquids, so
(C21=20 0RC21=25 0RC21=30
) is created and used as the selection condition (search condition) for table T2. As a result, the searched table T2
The number of records ' has been reduced from 50 to 3, indicating that the efficiency of the 3-in processing is much improved compared to the conventional method.

〔実施例〕〔Example〕

以下1本発明の一実施例について図面により説明する。 An embodiment of the present invention will be described below with reference to the drawings.

第1図は本発明の一実施例のブロック図を示す。FIG. 1 shows a block diagram of one embodiment of the invention.

101はジョイン・フィールド抽出部で、ジョイン条件
を解析して、リレーショナル・データベース105から
既に検索済のジョイン対象テーブル1(Tl’)からジ
ョイン・フィールドの内容を抽出する。102は検索条
件組立て部で、ジョイン・フィールド抽出部101が抽
出したジョイン・フィールドの内容より検索条件を組立
て、別のジョイン対象テーブル2(T2)の検索条件に
付加する。103はレコード検索部で、検索条件組立て
部102が作成した検索条件で、リレーショナル・デー
タベース105中のジョイン対象テーブル2のレコード
を検索し、検索条件に合致したレコードのみのジョイン
対象テーブル3 (T2’ )を生成する。ジョイン処
理部104は、テーブル1及び3のレコードを対象に、
ジョイン・フィールドの合致するレコードを組として抽
出するジョイン処理を行う。
A join field extraction unit 101 analyzes the join conditions and extracts the contents of the join fields from the join target table 1 (Tl') that has already been searched from the relational database 105. A search condition assembling unit 102 assembles a search condition from the contents of the join field extracted by the join field extraction unit 101, and adds it to the search condition of another join target table 2 (T2). Reference numeral 103 denotes a record search unit that searches for records in the join target table 2 in the relational database 105 using the search conditions created by the search condition assembling unit 102, and searches the join target table 3 (T2') for only records that match the search conditions. ) is generated. The join processing unit 104 targets the records of tables 1 and 3,
Performs join processing to extract records with matching join fields as a set.

゛第3図以下に、本実施例の具体的処理例を挙げる。゛Specific processing examples of this embodiment are listed below in Fig. 3.

第3図は検索条件及びジョイン条件をデータベース操作
言語で記述したものである。301はデータベース操作
言語で、302,303,304はジョイン対象テーブ
ル1のレコードの検索条件、305はジョイン対象テー
ブル2のレコードの検索条件を示す。306はテーブル
1と3のレコードのジョイン条件を示す。
FIG. 3 shows search conditions and join conditions written in a database operation language. 301 is a database operation language; 302, 303, and 304 are search conditions for records in join target table 1; and 305 are search conditions for records in join target table 2. 306 indicates join conditions for records in tables 1 and 3.

第4図及び第5図はジョイン処理となるテーブルの具体
例を示したもので、401は製品衣、501はメーカ表
である。
FIGS. 4 and 5 show specific examples of tables used in join processing, where 401 is a product table and 501 is a manufacturer table.

第4図の製品衣401の中から、第3図の302.30
3,304の検索条件に合致するレコードのみを取出し
たのがテーブル402であり、これが第1図の検索済の
ジョイン対象テーブル1に対応する。このテーブル40
2からジョイン・フィールド抽出部101でジョイン・
フィールド403(メーカ名)を抽出し、検索条件組立
て部102において、この抽出した内容より検索条件を
組立てたものが、第6図の検索条件602である。
From the product clothing 401 in Figure 4, 302.30 in Figure 3
A table 402 is obtained by extracting only the records matching the search conditions No. 3 and 304, and this corresponds to the searched join target table 1 in FIG. This table 40
2, the join field extraction unit 101 performs a join.
The field 403 (manufacturer name) is extracted, and the search condition assembling unit 102 assembles a search condition from the extracted contents, resulting in the search condition 602 in FIG.

第6図の検索条件601は、第3図の305で示される
メーカ表501の検索条件である。第6図中、603は
フィールド識別子、604は比較演算子、605は比較
値数、606,607は比較値で、このうち、比較値6
07がジョイン・フィールド抽出部lotで抽出したジ
ョイン・フィールドの内容である。
A search condition 601 in FIG. 6 is a search condition for the manufacturer table 501 indicated by 305 in FIG. In Fig. 6, 603 is a field identifier, 604 is a comparison operator, 605 is the number of comparison values, and 606 and 607 are comparison values.
07 is the content of the join field extracted by the join field extractor lot.

レコード検索部103は、検索条件601,602を共
に満足するレコードを第5図のメーカ表501(第1図
のジョイン対象テーブル2に対応)から検索し、テーブ
ル502(第1図のテーブル3に対応)を生成する。ジ
ョイン処理部104は。
The record search unit 103 searches for a record that satisfies both search conditions 601 and 602 from the manufacturer table 501 in FIG. 5 (corresponding to join target table 2 in FIG. corresponding). The join processing unit 104.

テーブル402及び502のレコードを対象に、それぞ
れのジョイン・フィールド403及び503が、第3図
のジョイン条件306に合致するレコードを組として抽
出するジョイン処理を行う。
A join process is performed for records in tables 402 and 502 to extract records whose respective join fields 403 and 503 match the join condition 306 in FIG. 3 as a set.

ジョイン処理自体は従来と同じである。The join process itself is the same as before.

本実施例によれば、メーカ表501のレコードを検索し
、検索結果メーカ表502を生成する過程において、シ
ミインの可能性のないレコードを排除できるので、ジョ
イン処理での、不要なレコードを含めたソート処理及び
ジョイン・フィールドの比較処理がなくなり、ジョイン
処理の処理性能が向上する。
According to this embodiment, in the process of searching for records in the manufacturer table 501 and generating the search result manufacturer table 502, it is possible to exclude records with no possibility of simi-in. Sorting processing and join field comparison processing are eliminated, improving the processing performance of join processing.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、本発明によれば、ジョイン処理の
実行時、ジョインの可能性のない不要なレコードを含め
たソート処理、及び不要なレコードとのジョイン・フィ
ールドの比較処理が排除出来るので、ジ1イン処理の処
理性能を著しく向上させる効果がある。
As explained above, according to the present invention, when performing a join process, it is possible to eliminate the sorting process that includes unnecessary records that have no possibility of being joined, and the process of comparing join fields with unnecessary records. This has the effect of significantly improving the processing performance of one-in processing.

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

第1図は本発明の一実施例のブロック図、第2図はジョ
イン処理の概要を説明する図、第3図はデータベース操
作言語で記述したジョイン検索条件の具体例を示す図、
第4図は一方のジョイン対象テーブルの具体例を示す図
、第5図は他方のジョイン対象テーブルの具体例を示す
図、第6図は他方のジョイン対象テーブルの検索条件の
具体例を示す図である。 101・・・ジョイン・フィールド抽出部、102・・
・検索条件組立て部、 103・・・レコード検索部、 104・・・ジョイン処理部、 105・・・リレーショナル・データベース。 第  2  図
FIG. 1 is a block diagram of an embodiment of the present invention, FIG. 2 is a diagram explaining an overview of join processing, and FIG. 3 is a diagram showing a specific example of join search conditions written in a database operation language.
FIG. 4 is a diagram showing a specific example of one join target table, FIG. 5 is a diagram showing a specific example of the other join target table, and FIG. 6 is a diagram showing a specific example of search conditions for the other join target table. It is. 101...Join field extraction section, 102...
- Search condition assembling unit, 103...Record search unit, 104...Join processing unit, 105...Relational database. Figure 2

Claims (1)

【特許請求の範囲】[Claims] (1)複数のフィールドに対応する属性情報よりなる同
一種類のレコードがまとめて記述されるテーブルを複数
個備えたリレーショナル・データベースにおいて、上記
複数個のテーブルをジヨイン・フィールドにもとづいて
ジヨインし、ジョイン条件に合致したレコードを組とし
て抽出する際、検索条件により既に検索済の第1のテー
ブルからジョイン・フィールドの内容を抽出し、該抽出
した内容を第2のテーブルの検索条件に付加して新たに
検索条件を組立て、該検索条件に合致するレコードを第
2のテーブルから検索して第3のテーブルを生成し、前
記第1および第3のテーブルを対象にジヨイン処理を行
うことを特徴とするリレーショナル・データベースのレ
コード検索方法。
(1) In a relational database that has multiple tables in which records of the same type consisting of attribute information corresponding to multiple fields are collectively described, join the multiple tables mentioned above based on the join field. When extracting records that match the conditions as a set, the contents of the join field are extracted from the first table that has already been searched according to the search conditions, and the extracted contents are added to the search conditions of the second table to create a new table. The method is characterized by assembling a search condition, searching a second table for a record matching the search condition to generate a third table, and performing join processing on the first and third tables. How to search for records in relational databases.
JP63152048A 1988-06-20 1988-06-20 Method for retrieving record of relational data base Pending JPH023870A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63152048A JPH023870A (en) 1988-06-20 1988-06-20 Method for retrieving record of relational data base

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63152048A JPH023870A (en) 1988-06-20 1988-06-20 Method for retrieving record of relational data base

Publications (1)

Publication Number Publication Date
JPH023870A true JPH023870A (en) 1990-01-09

Family

ID=15531916

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63152048A Pending JPH023870A (en) 1988-06-20 1988-06-20 Method for retrieving record of relational data base

Country Status (1)

Country Link
JP (1) JPH023870A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04213765A (en) * 1990-02-13 1992-08-04 Internatl Business Mach Corp <Ibm> How to join tables in relational database systems

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS607556A (en) * 1983-06-27 1985-01-16 Fujitsu Ltd Join processing system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS607556A (en) * 1983-06-27 1985-01-16 Fujitsu Ltd Join processing system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04213765A (en) * 1990-02-13 1992-08-04 Internatl Business Mach Corp <Ibm> How to join tables in relational database systems

Similar Documents

Publication Publication Date Title
O'Neil et al. Multi-table joins through bitmapped join indices
JP3104708B2 (en) How to join tables in a relational database system
US8037059B2 (en) Implementing aggregation combination using aggregate depth lists and cube aggregation conversion to rollup aggregation for optimizing query processing
US6185557B1 (en) Merge join process
US5557791A (en) Outer join operations using responsibility regions assigned to inner tables in a relational database
US6266660B1 (en) Secondary index search
US7240044B2 (en) Query optimization by sub-plan memoization
US5345585A (en) Method for optimizing processing of join queries by determining optimal processing order and assigning optimal join methods to each of the join operations
US5978794A (en) Method and system for performing spatial similarity joins on high-dimensional points
US6947934B1 (en) Aggregate predicates and search in a database management system
US6122644A (en) System for halloween protection in a database system
JP2005521954A (en) Method and apparatus for querying a relational database
JP2002024281A (en) Database arithmetic processor
US20040054683A1 (en) System and method for join operations of a star schema database
JPH03156571A (en) Join processing methods in relational databases
JPH023870A (en) Method for retrieving record of relational data base
US20020138464A1 (en) Method and apparatus to index a historical database for efficient multiattribute SQL queries
US20230117176A1 (en) Data Warehouse Indexed String Token Search
Mishra et al. Performance evaluation and analysis of k-way join variants for association rule mining
JPH01163826A (en) Coupling processing system for relational data base
JPS6257020A (en) Merging process system for relational data base
JP2000163446A (en) Extendable inquiry processor
JPH04156624A (en) High speed accessing systme in knowledge base systme
JPH0333979A (en) Processing method for definitive predicate of relational database
JP2001265783A (en) Star schemer retrieving system and program recording medium therefor