JPH0554082A - Data base system - Google Patents
Data base systemInfo
- Publication number
- JPH0554082A JPH0554082A JP3233991A JP23399191A JPH0554082A JP H0554082 A JPH0554082 A JP H0554082A JP 3233991 A JP3233991 A JP 3233991A JP 23399191 A JP23399191 A JP 23399191A JP H0554082 A JPH0554082 A JP H0554082A
- Authority
- JP
- Japan
- Prior art keywords
- search
- narrowing
- retrieval
- cost
- column
- 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
Links
- 238000000034 method Methods 0.000 claims abstract description 81
- 238000005457 optimization Methods 0.000 description 30
- 230000014509 gene expression Effects 0.000 description 20
- 238000010586 diagram Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 1
- 229920000136 polysorbate Polymers 0.000 description 1
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02E—REDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
- Y02E60/00—Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation
- Y02E60/30—Hydrogen technology
- Y02E60/50—Fuel cells
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
【0001】[0001]
【技術分野】本発明はデータベースシステムに関し、特
にデータの最小単位である列が集合された表に対して一
部分の列のみを指定して検索および更新が可能なデータ
ベースシステムに関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a database system, and more particularly to a database system capable of searching and updating by designating only a part of columns in a table in which columns, which are the minimum unit of data, are assembled.
【0002】[0002]
【従来技術】従来、この種のデータベースシステムにお
いては、利用者によって入力されたデータの最小単位を
列として管理し、複数の列を連結したものをレコードと
して記憶装置に格納する記憶構造を持っている。この記
憶装置に記憶した列の集合が表として利用者に提供され
ており、利用者はその表に対して一部分の列のみを指定
して検索および更新することができるようになってい
る。尚、この検索処理は利用者が指定した順番に行われ
ている。2. Description of the Related Art Conventionally, a database system of this type has a storage structure in which a minimum unit of data input by a user is managed as a column and a concatenation of a plurality of columns is stored as a record in a storage device. There is. A set of columns stored in this storage device is provided to the user as a table, and the user can search and update by designating only a part of columns in the table. The search process is performed in the order specified by the user.
【0003】このような従来のデータベースシステムで
は、記憶装置に記憶した列に対する検索処理が利用者の
指定した順番に行われているので、利用者が指定した順
番以外に検索時間の短い順番があっても利用することが
できず、検索時間が浪費されてしまうという問題があ
る。In such a conventional database system, since the retrieval processing for the columns stored in the storage device is performed in the order designated by the user, there is an order having a short retrieval time other than the order designated by the user. However, there is a problem that it cannot be used and the search time is wasted.
【0004】[0004]
【発明の目的】本発明は上記のような従来のものの問題
点を除去すべくなされたもので、データベースに対する
検索処理を高速化することができるデータベースシステ
ムの提供を目的とする。SUMMARY OF THE INVENTION The present invention has been made in order to eliminate the above-mentioned problems of the prior art, and an object of the present invention is to provide a database system capable of accelerating a search process for a database.
【0005】[0005]
【発明の構成】本発明によるデータベースシステムは、
利用者によって列単位で入力された複数のデータをレコ
ードとして記憶し、前記レコードの集合からなる表に対
して一部分の列のみを指定して検索および更新を行うデ
ータベースシステムであって、前記利用者から要求され
た検索指示をどの位の割合で絞り込むことが期待できる
かを示す絞り込み率を算出する絞り込み率算出手段と、
前記絞り込み率算出手段によって算出された前記絞り込
み率に基づいて検索コストを算出する検索コスト算出手
段と、前記検索コスト算出手段によって算出された前記
検索コストに基づいて前記検索指示に対するアクセスル
ートを決定する決定手段とを有することを特徴とする。The database system according to the present invention comprises:
A database system for storing a plurality of data input by a user in units of columns as a record and performing a search and update by designating only a part of columns in a table composed of the set of records, wherein the user A narrowing-down rate calculating unit that calculates a narrowing-down rate that indicates how much the search instruction requested from can be expected to be narrowed down,
A search cost calculating means for calculating a search cost based on the narrowing rate calculated by the narrowing rate calculating means, and an access route for the search instruction based on the search cost calculated by the search cost calculating means And determining means.
【0006】[0006]
【実施例】次に、本発明の一実施例について図面を参照
して説明する。An embodiment of the present invention will be described with reference to the drawings.
【0007】図1は本発明の一実施例の構成を示すブロ
ック図である。図において、データベースシステム1は
入出力装置9を介して入力された利用者からのデータベ
ース検索指示を受取ると、最適化レベル決定部2に制御
を渡す。最適化レベル決定部2では利用者がどのレベル
に最適化レベルを設定したか判定し、その判定結果を検
索指定編集部3と絞り込み率算出部4と検索コスト算出
部7とアクセスルート決定部8とに夫々出力してそれら
を呼び出す。FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention. In the figure, when the database system 1 receives a database search instruction input from the user via the input / output device 9, it transfers control to the optimization level determination unit 2. The optimization level determination unit 2 determines to which level the user has set the optimization level, and the determination result is used as a search designation editing unit 3, a narrowing rate calculation unit 4, a search cost calculation unit 7, and an access route determination unit 8. And output them respectively and call them.
【0008】ここで、利用者は最適化レベル決定部2に
対してFULL最適化とHALF最適化とNONE最適化とのうちい
ずれかを設定することができる。FULL最適化を設定した
場合には統計情報および知識ベースのすべてを利用して
検索方法の決定が行われる。HALF最適化を設定した場合
には統計情報および知識ベースの一部を利用して検索方
法の決定が行われる。NONE最適化を設定した場合には統
計情報および知識ベースを利用することなく検索方法の
決定が行われる。Here, the user can set any of FULL optimization, HALF optimization, and NONE optimization for the optimization level determining unit 2. When FULL optimization is set, the search method is determined using all of the statistical information and knowledge base. When HALF optimization is set, the search method is determined using the statistical information and part of the knowledge base. When NONE optimization is set, the search method is decided without using the statistical information and knowledge base.
【0009】検索指定編集部3は利用者からの問い合わ
せに記述された検索式や該検索式内の表や列に対応する
統計情報などから検索方法を決定し、その検索方法を絞
り込み率算出部4に送出する。この場合、利用者からの
1回の検索要求で1つの検索方法しかないということは
ないので、複数の検索方法が決定される。The search designation editing unit 3 determines a search method from the search formula described in the inquiry from the user and the statistical information corresponding to the tables and columns in the search formula, and the search method is narrowed down to a narrowing rate calculation unit. Send to 4. In this case, since there is no case where there is only one search method for one search request from the user, a plurality of search methods are determined.
【0010】例えば、「列1>=10 AND 列1<
=50」という検索式が記述されているのであれば、
「列1>=10」の検索結果と「列1<=50」の検索
結果との論理積をとる方法、および「列1>=10 A
ND 列1<=50」をBETWEEN 述語で示した「列1
BETWEEN 10 AND 50」で検索する方法という
2種類の検索方法があることになる。For example, "column 1> = 10 AND column 1 <
= 50 ”is described, if
A method of taking a logical product of the search result of “column 1> = 10” and the search result of “column 1 <= 50”, and “column 1> = 10 A
ND column 1 <= 50 "in the BETWEEN predicate" column 1 "
There will be two types of search methods, the method of searching with "BETWEEN 10 AND 50".
【0011】また、「列1 IN (1,2,3)」と
いう検索式が記述されているのであれば、「列1 IN
(1,2,3)」で検索する方法、「列1 IN
(1,2)」の検索結果と「列1=3」の検索結果との
論理和をとる方法、「列1=1」の検索結果と「列1=
2」の検索結果と「列1=3」の検索結果との論理和を
とる方法という3種類の検索方法があることになる。If the search expression "column 1 IN (1,2,3)" is written, "column 1 IN (1,2,3)" is written.
(1,2,3) "search method," Column 1 IN
A method of taking the logical sum of the search result of (1, 2) and the search result of “column 1 = 3”, and the search result of “column 1 = 1” and “column 1 =”
There are three types of search methods, namely, a method of taking the logical sum of the search result of "2" and the search result of "column 1 = 3".
【0012】絞り込み率算出部4は最適化レベル決定部
2によって呼び出されると、利用者によって指定された
検索指示がどの位の割合で絞り込むことが期待できるか
を示す絞り込み率を検索指定編集部3からの検索方法毎
に算出する。When the optimization level determination unit 2 calls the narrowing-down rate calculating unit 4, the narrowing-down rate indicating the rate at which the search instruction designated by the user can be expected to be narrowed down is designated by the search designation editing unit 3. Calculate for each search method from.
【0013】すなわち、絞り込み率算出部4はまず利用
者からの問い合わせに記述された検索式が論理条件か、
あるいはスカラ演算かを判定する。絞り込み率算出部4
は検索式をスカラ演算と判定すると、統計情報入力部5
を呼び出して統計情報格納ファイル6から表や列に対応
する統計情報を読出す。その後、絞り込み率算出部4は
統計情報格納ファイル6から読出した統計情報に基づい
て検索方法毎に絞り込み率を算出し、その絞り込み率を
検索コスト算出部7に送出する。That is, the narrowing-down rate calculating unit 4 first determines whether the search expression described in the inquiry from the user is a logical condition,
Alternatively, it is determined whether it is a scalar operation. Narrowing rate calculation unit 4
Determines that the search expression is a scalar operation, the statistical information input unit 5
To read the statistical information corresponding to the table or column from the statistical information storage file 6. After that, the narrowing-down rate calculating unit 4 calculates the narrowing-down rate for each search method based on the statistical information read from the statistical information storage file 6, and sends the narrowing-down rate to the search cost calculating unit 7.
【0014】ここで、例えば列1〜列4からなる表Aを
検索するために、検索式「列1>=10 AND 列1
<=50」が与えられ、「列1は重複データなし、
列1の全件数は200 件、列1の値と値との間隔の平均
値は2.0、表Aのレコードを読込むときの1作業領
域中のレコード数は50レコード」という統計情報が得
られたとすると、BETWEEN 述語で示した「列1 BETWEE
N 10 AND 50」で検索する方法の場合、 絞り込み率=[(50−10)/2]/200=0.1 となる。これに対して「列1>=10」の検索結果と
「列1<=50」の検索結果との論理積をとる方法の場
合、 絞り込み率=[(10/1)/200]+[(50/
1)/200]+α =0.05+0.25+α =0.3+α となる。尚、[(10/1)/200]は「列1>=1
0」の検索を行うときの絞り込み率であり、[(50/
1)/200]は「列1<=50」の検索を行うときの
絞り込み率であり、αはそれら検索結果の論理積を行う
ときの絞り込み率である。Here, for example, in order to search the table A composed of columns 1 to 4, the search formula "column 1> = 10 AND column 1"
<= 50 ”is given,“ Column 1 has no duplicate data,
The total number of records in column 1 is 200, the average value between the values in column 1 is 2.0, and the number of records in one work area when reading the records in table A is 50 records. " If it is obtained, it is shown in the BETWEEN predicate "column 1 BETWEE
In the case of the method of searching by "N 10 AND 50", the narrowing rate = [(50-10) / 2] /200=0.1. On the other hand, in the case of the method of taking the logical product of the search result of “column 1> = 10” and the search result of “column 1 <= 50”, the narrowing rate = [(10/1) / 200] + [( 50 /
1) / 200] + α 2 = 0.05 + 0.25 + α 2 = 0.3 + α. Note that [(10/1) / 200] is “column 1> = 1”
It is the narrowing down ratio when searching for "0", which is [(50 /
1) / 200] is a narrowing down ratio when searching for “column 1 <= 50”, and α is a narrowing down ratio when performing a logical product of those search results.
【0015】よって、BETWEEN 述語で示した「列1 BE
TWEEN 10 AND 50」で検索する方法の絞り込
み率は「列1>=10」の検索結果と「列1<=50」
の検索結果との論理積をとる方法の絞り込み率よりも小
さいことになる。Therefore, "column 1 BE" shown in the BETWEEN predicate
The narrowing-down rate of the search method using "TWEEN 10 AND 50" is "column 1> = 10" and "column 1 <= 50".
This is smaller than the narrowing rate of the method of taking the logical product with the search result of.
【0016】検索コスト算出部7は絞り込み率算出部4
からの絞り込み率と、統計情報入力部5が統計情報格納
ファイル6から読出した統計情報とに基づいて検索方法
毎に検索コストを算出し、その検索方法毎の検索コスト
をアクセスルート決定部8に送出する。ここで、検索コ
ストとは利用者からの1回の検索要求によるファイル入
出力に伴う入出力コストのことであり、検索コストの値
が大きいほどデータベース(図示せず)へのアクセスに
時間がかかることになる。The search cost calculation section 7 is a narrowing rate calculation section 4
The search cost is calculated for each search method on the basis of the narrowing-down rate and the statistical information read by the statistical information input unit 5 from the statistical information storage file 6, and the search cost for each search method is sent to the access route determination unit 8. Send out. Here, the search cost is the input / output cost associated with the file input / output by one search request from the user, and the larger the search cost value, the longer it takes to access the database (not shown). It will be.
【0017】例えば、1回のファイル入出力で扱うレコ
ード数を10レコードとすると、上述のBETWEEN 述語で
示した「列1 BETWEEN 10 AND 50」で検索
する方法の場合、 検索コスト=(全レコード数×絞り込み率)÷1回のフ
ァイル入出力のレコード数 =(200×0.1)÷10 =2.0 となる。これに対して「列1>=10」の検索結果と
「列1<=50」の検索結果との論理積をとる方法の場
合、 検索コスト=[200×(0.3+α)]÷10 =6.0+20α となる。よって、BETWEEN 述語で示した「列1 BETWEE
N 10 AND 50」で検索する方法の検索コスト
は「列1>=10」の検索結果と「列1<=50」の検
索結果との論理積をとる方法の検索コストよりも小さい
ことになる。For example, assuming that the number of records handled in one file input / output is 10, the search cost = (total number of records) in the method of searching by "column 1 BETWEEN 10 AND 50" shown in the BETWEEN predicate described above. × Narrowing down rate) / the number of records of one file input / output = (200 × 0.1) / 10 10 = 2.0. On the other hand, in the case of the method of taking the logical product of the search result of “column 1> = 10” and the search result of “column 1 <= 50”, search cost = [200 × (0.3 + α)] / 10 = It becomes 6.0 + 20α. Therefore, "column 1 BETWEE" shown in the BETWEEN predicate
The search cost of the method of searching with "N 10 AND 50" is smaller than the search cost of the method of logically ANDing the search result of "column 1> = 10" and the search result of "column 1 <= 50". ..
【0018】アクセスルート決定部8は検索コスト算出
部7で算出された検索方法毎の検索コスト同士を比較
し、最も小さい検索コストの検索方法をアクセスルート
の情報として最適化レベル決定部2を介してデータベー
スシステム1に送出する。The access route determining unit 8 compares the search costs for each search method calculated by the search cost calculating unit 7 and uses the search method with the smallest search cost as access route information via the optimization level determining unit 2. To the database system 1.
【0019】例えば、上述の如く「列1>=10 AN
D 列1<=50」という検索式が記述されている場
合、検索コストの小さいBETWEEN 述語で示した「列1
BETWEEN 10 AND 50」で検索する方法がアク
セスルートの情報となる。For example, as described above, "column 1> = 10 AN"
When the search expression "D column 1 <= 50" is described, "column 1" shown in the BETWEEN predicate with a low search cost
BETWEEN 10 AND 50 ”will be used as the access route information.
【0020】図2は図1の最適化レベル決定部2の動作
を示すフローチャートであり、図3は図1の検索指定編
集部3の動作を示すフローチャートであり、図4は図1
の絞り込み率算出部4の動作を示すフローチャートであ
り、図5は図1の統計情報入力部5の動作を示すフロー
チャートであり、図6は図1の検索コスト算出部7の動
作を示すフローチャートであり、図7は図1のアクセス
ルート決定部8の動作を示すフローチャートである。こ
れら図1〜図7を用いて本発明の一実施例の動作につい
て説明する。FIG. 2 is a flow chart showing the operation of the optimization level determining unit 2 in FIG. 1, FIG. 3 is a flow chart showing the operation of the search designation editing unit 3 in FIG. 1, and FIG.
6 is a flowchart showing the operation of the narrowing-down rate calculation unit 4, FIG. 5 is a flowchart showing the operation of the statistical information input unit 5 of FIG. 1, and FIG. 6 is a flowchart showing the operation of the search cost calculation unit 7 of FIG. Yes, FIG. 7 is a flowchart showing the operation of the access route determination unit 8 of FIG. The operation of the embodiment of the present invention will be described with reference to FIGS.
【0021】データベースシステム1は入出力装置9を
介して利用者からデータベース検索指示が入力される
と、最適化レベル決定部2に制御を渡す。最適化レベル
決定部2はまず利用者がどのレベルに最適化レベルを設
定したか、つまり統計情報を利用するかどうかを判定す
る(図2ステップ11)。最適化レベル決定部2は統計
情報を利用すると判定した場合、絞り込み率算出部4と
検索コスト算出部7と検索指定編集部3とアクセスルー
ト決定部8とを順番に呼び出す(図2ステップ11〜1
5)。When the database search instruction is input from the user via the input / output device 9, the database system 1 transfers control to the optimization level determining unit 2. The optimization level determination unit 2 first determines to which level the user has set the optimization level, that is, whether to use the statistical information (step 11 in FIG. 2). When the optimization level determining unit 2 determines to use the statistical information, it calls the narrowing rate calculating unit 4, the search cost calculating unit 7, the search designation editing unit 3, and the access route determining unit 8 in order (steps 11 to 11 in FIG. 2). 1
5).
【0022】一方、最適化レベル決定部2は統計情報を
利用しないと判定した場合、知識ベース(図示せず)を
利用するかどうかを判定する(図2ステップ16)。こ
こで、知識ベースとは長年に渡るリレーショナルデータ
ベースの開発で蓄積された経験や知識を格納するもので
ある。On the other hand, when it is determined that the statistical information is not used, the optimization level determining unit 2 determines whether to use a knowledge base (not shown) (step 16 in FIG. 2). Here, the knowledge base stores the experience and knowledge accumulated in the development of a relational database over many years.
【0023】最適化レベル決定部2は知識ベースを利用
すると判定した場合、検索指定編集部3とアクセスルー
ト決定部8とを順番に呼び出す(図2ステップ14,1
5)。また、最適化レベル決定部2は知識ベースを利用
しないと判定した場合、アクセスルート決定部8を呼び
出す(図2ステップ15)。When the optimization level determining unit 2 determines to use the knowledge base, it calls the search designation editing unit 3 and the access route determining unit 8 in order (steps 14 and 1 in FIG. 2).
5). If the optimization level determining unit 2 determines not to use the knowledge base, it calls the access route determining unit 8 (step 15 in FIG. 2).
【0024】検索指定編集部3は最適化レベル決定部2
から呼び出されると、利用者からの問い合わせに記述さ
れた検索式においてスカラ条件がすべて等号で結ばれて
いるか否かを判定する(図3ステップ21)。検索指定
編集部3は検索式においてスカラ条件がすべて等号で結
ばれていると判定すると、論理条件がすべてアンド(論
理積)で結ばれているか否かを判定する(図3ステップ
22)。The search designation editing unit 3 is an optimization level determining unit 2
Is called from, it is determined whether all the scalar conditions in the search expression described in the inquiry from the user are connected by equal signs (step 21 in FIG. 3). When the search specification editing unit 3 determines that all scalar conditions are connected by equal signs in the search expression, it determines whether all logical conditions are connected by AND (logical product) (step 22 in FIG. 3).
【0025】検索指定編集部3は検索式において論理条
件がすべてアンドで結ばれていると判定すると、該検索
式に記述された表の種類が単一か否かを判定する(図3
ステップ23)。検索指定編集部3は検索式に記述され
た表の種類が単一と判定すると、検索式を評価するのに
適用できるインデックス(索引)が付与されているか否
かを判定する(図3ステップ24)。検索指定編集部3
はインデックスが付与されていると判定すると、該検索
式の検索方法をインデックス検索とし、その検索方法を
絞り込み率算出部4に送出する(図3ステップ25)。When the search specification editing unit 3 determines that all logical conditions are connected by AND in the search expression, it determines whether the type of the table described in the search expression is single (FIG. 3).
Step 23). When the search specification editing unit 3 determines that the type of the table described in the search expression is single, it determines whether or not an index (index) applicable to evaluate the search expression is added (step 24 in FIG. 3). ). Search specification editorial department 3
When it is determined that the index is added, the search method of the search formula is set to index search, and the search method is sent to the narrowing rate calculation unit 4 (step 25 in FIG. 3).
【0026】一方、検索指定編集部3はステップ21で
スカラ条件がすべて等号で結ばれていないと判定する
と、あるいはステップ22で論理条件がすべてアンドで
結ばれていないと判定すると、該検索式に記述された表
の種類が複数か否かを判定する(図3ステップ26)。
検索指定編集部3は検索式に記述された表の種類が複数
であると判定すると、あるいはステップ23で検索式に
記述された表の種類が単一ではないと判定すると、該検
索式の検索方法をネステッドループ結合検索とし、その
検索方法を絞り込み率算出部4に送出する(図3ステッ
プ27)。On the other hand, when the search designation editing unit 3 determines in step 21 that all the scalar conditions are not connected by equal signs, or in step 22 that all the logical conditions are not connected by AND, the search expression It is determined whether there are a plurality of types of tables described in (2) (step 26 in FIG. 3).
When the search designation editing unit 3 determines that there are a plurality of types of tables described in the search formula, or when it determines that the type of table described in the search formula is not single in step 23, the search of the search formula is performed. The method is a nested loop connection search, and the search method is sent to the narrowing rate calculation unit 4 (step 27 in FIG. 3).
【0027】ここで、ネステッドループ結合検索とは結
合元の最初のレコードと、結合先の最初のレコードから
最終のレコードまでのレコードとにおいて検索条件を順
次判定し、その判定が終了した後に結合元の次のレコー
ドと、結合先の最初のレコードから最終のレコードまで
のレコードとにおいて検索条件を順次判定する。このよ
うな判定を繰返し行うことによって検索を行う方法であ
る。Here, the nested loop join search is performed by sequentially determining search conditions in the first record of the join source and the records from the first record to the last record of the join destination, and after the decision is completed, the join source The search condition is sequentially determined for the next record and the records from the first record to the last record to be combined. This is a method of performing a search by repeatedly making such a determination.
【0028】また、検索指定編集部3はステップ24で
インデックスが付与されていないと判定すると、あるい
はステップ26で検索式に記述された表の種類が複数で
はないと判定すると、該検索式の検索方法を順検索と
し、その検索方法を絞り込み率算出部4に送出する(図
3ステップ28)。Further, when the search designation editing unit 3 determines in step 24 that the index is not added, or in step 26 that the number of types of tables described in the search formula is not plural, the search formula is searched. The method is a sequential search, and the search method is sent to the narrowing rate calculation unit 4 (step 28 in FIG. 3).
【0029】絞り込み率算出部4は最適化レベル決定部
2によって呼び出されると、利用者からの問い合わせに
記述された検索式を順に抽出し(図4ステップ31)、
抽出した検索式が論理条件か否か判定する(図4ステッ
プ32)。When called by the optimization level determining unit 2, the narrowing rate calculating unit 4 sequentially extracts the search formulas described in the inquiry from the user (step 31 in FIG. 4).
It is determined whether the extracted search expression is a logical condition (step 32 in FIG. 4).
【0030】絞り込み率算出部4は検索式が論理条件で
あると判定すると、検索式に記述された両辺の検索式を
指定して絞り込み率を算出する(図4ステップ33)。
その後に、絞り込み率算出部4は検索式がまだ残ってい
るか否かを判定する(図4ステップ34)。検索式がま
だ残っていればステップ33に戻って絞り込み率の算出
を行い、検索式が残っていなければ最適化レベル決定部
2に制御を戻す。When the narrowing-down rate calculating unit 4 determines that the search expression is a logical condition, the narrowing-down rate is calculated by designating the search expressions on both sides described in the search expression (step 33 in FIG. 4).
After that, the narrowing-down rate calculating unit 4 determines whether or not the search formula still remains (step 34 in FIG. 4). If the search formula still remains, the process returns to step 33 to calculate the narrowing rate, and if the search formula does not remain, the control is returned to the optimization level determination unit 2.
【0031】一方、絞り込み率算出部4は検索式が論理
条件ではないと判定すると、検索式がスカラ演算か否か
を判定する(図4ステップ35)。絞り込み率算出部4
は検索式をスカラ演算と判定すると、スカラ演算の両辺
に記述された表や列を指定して統計情報入力部5を呼び
出して統計情報格納ファイル6から表や列に対応する統
計情報を読出す(図4ステップ36)。On the other hand, when the narrowing-down rate calculating unit 4 determines that the search expression is not a logical condition, it determines whether the search expression is a scalar operation (step 35 in FIG. 4). Narrowing rate calculation unit 4
Determines that the search expression is a scalar operation, calls the statistical information input unit 5 by specifying the tables and columns described on both sides of the scalar operation, and reads the statistical information corresponding to the table or column from the statistical information storage file 6. (FIG. 4, step 36).
【0032】その後、絞り込み率算出部4は統計情報格
納ファイル6から読出した統計情報に基づいて検索方法
毎に絞り込み率を算出した後に、表や列がまだ残ってい
るか否かを判定する(図4ステップ37)。表や列がま
だ残っていればステップ36に戻って統計情報格納ファ
イル6から読出した統計情報に基づいて検索方法毎に絞
り込み率の算出を行い、表や列が残っていなければ最適
化レベル決定部2に制御を戻す。ここで、上記の処理に
よって算出された絞り込み率や統計情報は検索コスト算
出部7に送出される。After that, the narrowing-down rate calculating unit 4 calculates the narrowing-down rate for each search method based on the statistical information read from the statistical information storage file 6, and then determines whether or not tables and columns still remain (FIG. 4 step 37). If the table or column still remains, the process returns to step 36 and the narrowing rate is calculated for each search method based on the statistical information read from the statistical information storage file 6, and if the table or column does not remain, the optimization level is determined. Return control to part 2. Here, the narrowing rate and the statistical information calculated by the above processing are sent to the search cost calculation unit 7.
【0033】統計情報入力部5は絞り込み率算出部4に
よって呼び出されると、統計情報格納ファイル6から読
出すデータが表か否かを判定する(図5ステップ4
1)。統計情報入力部5は読出すデータが表であると判
定すると、表データを読込む準備を行ってから(図5ス
テップ42)、統計情報格納ファイル6から指定された
表の統計情報を読出す(図5ステップ43)。統計情報
入力部5は読出した統計情報を絞り込み率算出部4に送
出してから、絞り込み率算出部4に制御を戻す。When the statistical information input unit 5 is called by the narrowing-down rate calculating unit 4, it determines whether or not the data read from the statistical information storage file 6 is a table (FIG. 5, step 4).
1). When the statistical information input unit 5 determines that the data to be read is a table, it prepares to read the table data (step 42 in FIG. 5) and then reads the statistical information of the specified table from the statistical information storage file 6. (FIG. 5, step 43). The statistical information input unit 5 sends the read statistical information to the narrowing-down rate calculating unit 4, and then returns control to the narrowing-down rate calculating unit 4.
【0034】一方、統計情報入力部5は読出すデータが
表ではないと判定すると、列データを読込む準備を行っ
てから(図5ステップ44)、統計情報格納ファイル6
から指定された列の統計情報を読出す(図5ステップ4
5)。統計情報入力部5は読出した統計情報を絞り込み
率算出部4に送出してから、絞り込み率算出部4に制御
を戻す。On the other hand, when the statistical information input unit 5 determines that the data to be read is not a table, it prepares to read the column data (step 44 in FIG. 5), and then the statistical information storage file 6
The statistical information of the designated column is read from (step 4 in FIG. 5).
5). The statistical information input unit 5 sends the read statistical information to the narrowing-down rate calculating unit 4, and then returns control to the narrowing-down rate calculating unit 4.
【0035】検索コスト算出部7は最適化レベル決定部
2によって呼び出されると、検索コストを算出するのが
表か否かを判定する(図6ステップ51)。表に対する
検索コストの算出であると判定すると、検索コスト算出
部7は絞り込み率算出部4から送られてきた絞り込み率
や統計情報に基づいて検索方法毎に表に対する検索コス
トを算出する(図6ステップ52)。また、表に対する
検索コストの算出ではないと判定すると、検索コスト算
出部7は絞り込み率算出部4から送られてきた絞り込み
率や統計情報に基づいて検索方法毎に列に対する検索コ
ストを算出する(図6ステップ53)。各々算出された
検索方法毎の表または列に対する検索コストがアクセス
ルート決定部8に送出されてから、アクセスルート決定
部8に制御が渡される。When the search cost calculation unit 7 is called by the optimization level determination unit 2, the search cost calculation unit 7 determines whether or not a table is used to calculate the search cost (step 51 in FIG. 6). When it is determined that the search cost is calculated for the table, the search cost calculation unit 7 calculates the search cost for the table for each search method based on the narrowing rate and the statistical information sent from the narrowing rate calculating unit 4 (FIG. 6). Step 52). When it is determined that the search cost is not calculated for the table, the search cost calculation unit 7 calculates the search cost for the column for each search method based on the narrowing rate and the statistical information sent from the narrowing rate calculating unit 4 ( 6 step 53). After the calculated search cost for the table or column for each search method is sent to the access route determination unit 8, the control is passed to the access route determination unit 8.
【0036】アクセスルート決定部8は検索コスト算出
部7から制御が渡されると、検索コスト算出部7で算出
された検索方法毎の検索コスト同士を比較する。すなわ
ち、まず最初の検索方法の検索コストを比較元の検索コ
ストmiとし、次の検索方法の検索コストを比較先の検
索コストm(i+1)としてこれら比較元の検索コスト
miと比較先の検索コストm(i+1)とを比較する
(図7ステップ61)。その結果、比較元の検索コスト
miが比較先の検索コストm(i+1)より大きい[m
i>m(i+1)]か否かを判定する(図7ステップ6
2)。When the search cost calculation unit 7 receives the control, the access route determination unit 8 compares the search costs calculated by the search cost calculation unit 7 for each search method. That is, the search cost of the first search method is set as the search cost mi of the comparison source, and the search cost of the next search method is set as the search cost m (i + 1) of the comparison target. It is compared with m (i + 1) (step 61 in FIG. 7). As a result, the comparison source search cost mi is larger than the comparison target search cost m (i + 1) [m
i> m (i + 1)] is determined (step 6 in FIG. 7).
2).
【0037】比較元の検索コストmiが比較先の検索コ
ストm(i+1)よりも大きければ、次の検索方法の検
索コストを比較元の検索コストmiとし、次の次の検索
方法の検索コストを比較先の検索コストm(i+1)と
する。つまり、iに1を加えたときの比較元の検索コス
トmiと比較先の検索コストm(i+1)とを比較する
(図7ステップ62,63)。If the comparison source search cost mi is larger than the comparison destination search cost m (i + 1), the comparison source search cost mi is set as the comparison source search cost mi. The search cost of the comparison destination is m (i + 1). That is, the search cost mi of the comparison source when 1 is added to i and the search cost m (i + 1) of the comparison target are compared (steps 62 and 63 in FIG. 7).
【0038】このとき、iが検索コスト算出部7で算出
された検索コストの数nを越えたか否かを判定する(図
7ステップ65)。iが検索コスト算出部7で算出され
た検索コストの数nを越えていれば、そのときの比較元
の検索コストmiを最短のアクセスルートの検索コスト
に、すなわち最も小さい検索コストを最短のアクセスル
ートの検索コストに決定する(図7ステップ66)。i
が検索コスト算出部7で算出された検索コストの数nを
越えていなければ、ステップ61に戻って上記の処理を
繰返し行う。At this time, it is determined whether i exceeds the number n of search costs calculated by the search cost calculation unit 7 (step 65 in FIG. 7). If i exceeds the number n of search costs calculated by the search cost calculation unit 7, the search cost mi of the comparison source at that time is set to the search cost of the shortest access route, that is, the smallest search cost is set to the shortest access. The route search cost is determined (step 66 in FIG. 7). i
Does not exceed the number n of search costs calculated by the search cost calculation unit 7, the process returns to step 61 and the above processing is repeated.
【0039】最短のアクセスルートの検索コストに決定
された比較元の検索コストmiに対応する検索方法から
アクセスルートの情報を作成し(図7ステップ67)、
そのアクセスルートの情報を最適化レベル決定部2を介
してデータベースシステム1に送出する。Access route information is created from the search method corresponding to the search cost mi of the comparison source determined as the search cost of the shortest access route (step 67 in FIG. 7).
Information on the access route is sent to the database system 1 via the optimization level determination unit 2.
【0040】次に、例えば「exp.SELECT 列1,列
2,列3 FROM 表1 WHERE (列1>=3) AND
(列1<=55)」という検索式が、入出力装置9を
介してデータベースシステム1に入力されると、WHERE
以降に記述されている「(列1>=3) AND (列
1<=55)」という検索式が抽出される。このとき、
利用者が「FULL最適化」を設定していれば、統計情報お
よび知識ベースのすべてが利用されてアクセスルートの
決定が行われる。Next, for example, "exp.SELECT column 1, column 2, column 3 FROM table 1 WHERE (column 1> = 3) AND
When the search expression "(column 1 <= 55)" is input to the database system 1 via the input / output device 9, the WHERE
A search expression “(column 1> = 3) AND (column 1 <= 55)” described below is extracted. At this time,
If the user has set "FULL optimization", the statistical information and knowledge base are all used to determine the access route.
【0041】検索指定編集部3は上記の検索式から「列
1>=3」の検索結果と「列1<=55」の検索結果と
の論理積をとる方法と、「列1>=3 AND 列1<
=55」をBETWEEN 述語で示した「列1 BETWEEN 3
AND 55」で検索する方法との2種類の検索方法
を決定し、絞り込み率算出部4に送出する。The search specification editing unit 3 calculates the logical product of the search result of "column 1> = 3" and the search result of "column 1 <= 55" from the above search formula, and "column 1> = 3". AND column 1 <
= 55 ”in the BETWEEN predicate,“ Column 1 BETWEEN 3
AND 55 ”and two types of search methods are determined and sent to the narrowing rate calculation unit 4.
【0042】絞り込み率算出部4は統計情報入力部5に
よって統計情報格納ファイル6から「列1は重複デー
タなし、列1の全件数は200 件、列1の値と値との
間隔の平均値は2.0、表Aのレコードを読込むとき
の1作業領域中のレコード数は50レコード」という統
計情報が読出されると、これらの統計情報に基づいて検
索指定編集部3からの検索方法毎に絞り込み率を算出す
る。The narrowing-down rate calculating unit 4 uses the statistical information input unit 5 to read from the statistical information storage file 6 that "column 1 has no duplicate data, the total number of cases in column 1 is 200, and the average value between the values in column 1 is the average value. Is 2.0 and the number of records in one work area when reading the records in Table A is 50 records ", the search method from the search designation editing unit 3 is based on these statistical information. The narrowing rate is calculated for each.
【0043】すなわち、BETWEEN 述語で示した「列1
BETWEEN 3 AND 55」で検索する方法の場合、 絞り込み率=[(55−3)/2]/200=0.13 となる。That is, "column 1" shown in the BETWEEN predicate
In the case of the method of searching with "BETWEEN 3 AND 55", the narrowing rate is [(55-3) / 2] /200=0.13.
【0044】これに対して「列1>=3」の検索結果と
「列1<=55」の検索結果との論理積をとる方法の場
合、 絞り込み率=[(3/1)/200]+[(55/1)
/200]+α =0.015+0.275+α =0.29+α となる。On the other hand, in the case of the method of taking the logical product of the search result of “column 1> = 3” and the search result of “column 1 <= 55”, the narrowing rate = [(3/1) / 200] + [(55/1)
/ 200] + α = 0.015 + 0.275 + α = 0.29 + α.
【0045】検索コスト算出部7は絞り込み率算出部4
からの絞り込み率と統計情報格納ファイル6から読出さ
れた統計情報とに基づいて、検索方法毎に検索コストを
算出し、その検索方法毎の検索コストをアクセスルート
決定部8に送出する。The search cost calculation unit 7 is the narrowing rate calculation unit 4
The search cost is calculated for each search method on the basis of the narrowing-down rate and the statistical information read from the statistical information storage file 6, and the search cost for each search method is sent to the access route determination unit 8.
【0046】例えば、1回のファイル入出力で扱うレコ
ード数を10レコードとすると、上述のBETWEEN 述語で
示した「列1 BETWEEN 3 AND 55」で検索す
る方法の場合、 検索コスト=(200×0.13)÷10=2.6 となる。これに対して「列1>=3」の検索結果と「列
1<=55」の検索結果との論理積をとる方法の場合、 検索コスト=[200×(0.29+α)]÷10=
5.8+20α となる。For example, assuming that the number of records handled in one file input / output is 10, the search cost = (200 × 0) in the case of the method of searching by “column 1 BETWEEN 3 AND 55” shown in the above BETWEEN predicate. .13) ÷ 10 = 2.6. On the other hand, in the case of the method of taking the logical product of the search result of “column 1> = 3” and the search result of “column 1 <= 55”, search cost = [200 × (0.29 + α)] / 10 =
It becomes 5.8 + 20α.
【0047】アクセスルート決定部8は検索コスト算出
部7で算出された検索方法毎の検索コスト同士を比較
し、最も小さい検索コストの検索方法をアクセスルート
の情報として作成する。この場合、BETWEEN 述語で示し
た「列1 BETWEEN 3 AND 55」で検索する方
法の検索コストが「列1>=3」の検索結果と「列1<
=55」の検索結果との論理積をとる方法の検索コスト
よりも小さいため、アクセスルート決定部8はBETWEEN
述語で示した「列1 BETWEEN 3 AND 55」で
検索する方法をアクセスルートの情報として作成する。The access route determination unit 8 compares the search costs calculated by the search cost calculation unit 7 for each search method, and creates the search method with the smallest search cost as access route information. In this case, the search cost of the method of searching by "column 1 BETWEEN 3 AND 55" indicated by the BETWEEN predicate is "column 1> = 3" and "column 1 <
= 55 ”, the access cost is less than the search cost of the method of taking the logical product with the search result.
The method of searching with "column 1 BETWEEN 3 AND 55" shown in the predicate is created as access route information.
【0048】このように、検索指定編集部3で決定され
た検索方法毎に、絞り込み率算出部4で絞り込み率を算
出し、その絞り込み率に基づいて検索コスト算出部7で
算出された検索方法毎の検索コストのうち検索コストが
最も小さい検索方法をアクセスルート決定部8で検出し
てその検索方法をアクセスルートの情報として作成する
ようにすることによって、データベースに対する利用者
からの検索要求において、実行結果を変えることなく処
理速度が早いアクセスルートを決定することができるの
で、データベースに対する検索処理を高速化することが
できる。As described above, the narrowing-down rate calculating section 4 calculates the narrowing-down rate for each searching method determined by the search-designating and editing section 3, and the searching method calculated by the search-cost calculating section 7 based on the narrowing-down rate. In the search request from the user to the database, the access route determination unit 8 detects the search method with the smallest search cost among the search costs for each and creates the search method as the information of the access route. Since the access route having a high processing speed can be determined without changing the execution result, the search processing for the database can be speeded up.
【0049】また、利用者による最適化レベルの設定を
可能とすることによって、利用者が検索方法の知識を有
していなくとも、知識ベースや統計情報の利用で最速の
検索方法を用いることができ、検索処理を高速化するこ
とができる。Further, by enabling the user to set the optimization level, even if the user does not have knowledge of the search method, the fastest search method can be used by using the knowledge base and the statistical information. Therefore, the search processing can be speeded up.
【0050】[0050]
【発明の効果】以上説明したように本発明によれば、検
索式から決定された検索方法毎に算出され、利用者から
要求された検索指示をどの位の割合で絞り込むことが期
待できるかを示す絞り込み率に基づいて検索コストを算
出し、最も小さい検索コストに対応する検索方法を該検
索指示に対するアクセスルートとして決定するようにす
ることによって、データベースに対する検索処理を高速
化することができるという効果がある。As described above, according to the present invention, it is possible to determine at what rate the search instructions calculated for each search method determined from the search formula and requested by the user can be narrowed down. An effect that the search process for the database can be sped up by calculating the search cost based on the narrowing-down ratio shown and determining the search method corresponding to the smallest search cost as the access route for the search instruction. There is.
【図1】本発明の一実施例の構成を示すブロック図であ
る。FIG. 1 is a block diagram showing a configuration of an exemplary embodiment of the present invention.
【図2】図1の最適化レベル決定部の動作を示すフロー
チャートである。FIG. 2 is a flowchart showing an operation of an optimization level determining unit in FIG.
【図3】図1の検索指定編集部の動作を示すフローチャ
ートである。FIG. 3 is a flowchart showing an operation of a search designation editing unit in FIG.
【図4】図1の絞り込み率算出部の動作を示すフローチ
ャートである。FIG. 4 is a flowchart showing an operation of a narrowing-down rate calculating unit in FIG.
【図5】図1の統計情報入力部の動作を示すフローチャ
ートである。5 is a flowchart showing the operation of the statistical information input unit of FIG.
【図6】図1の検索コスト算出部の動作を示すフローチ
ャートである。FIG. 6 is a flowchart showing an operation of a search cost calculation unit in FIG.
【図7】図1のアクセスルート決定部の動作を示すフロ
ーチャートである。FIG. 7 is a flowchart showing the operation of the access route determination unit of FIG.
1 データベースシステム 2 最適化レベル決定部 3 検索指定編集部 4 絞り込み率算出部 5 統計情報入力部 7 検索コスト算出部 8 アクセスルート決定部 1 database system 2 optimization level determination unit 3 search specification editing unit 4 narrowing rate calculation unit 5 statistical information input unit 7 search cost calculation unit 8 access route determination unit
Claims (3)
のデータをレコードとして記憶し、前記レコードの集合
からなる表に対して一部分の列のみを指定して検索およ
び更新を行うデータベースシステムであって、前記利用
者から要求された検索指示をどの位の割合で絞り込むこ
とが期待できるかを示す絞り込み率を算出する絞り込み
率算出手段と、前記絞り込み率算出手段によって算出さ
れた前記絞り込み率に基づいて検索コストを算出する検
索コスト算出手段と、前記検索コスト算出手段によって
算出された前記検索コストに基づいて前記検索指示に対
するアクセスルートを決定する決定手段とを有すること
を特徴とするデータベースシステム。1. A database system in which a plurality of data input by a user in units of columns are stored as records, and only a part of columns is specified in a table composed of a set of the records to perform search and update. Based on the narrowing-down rate calculated by the narrowing-down rate calculating means and a narrowing-down rate calculating means for calculating a narrowing-down rate indicating how much the search instruction requested by the user can be expected to be narrowed down. A database system comprising: a search cost calculating means for calculating a search cost according to the above; and a determining means for determining an access route for the search instruction based on the search cost calculated by the search cost calculating means.
記憶する知識ベースと、前記利用者によって要求された
検索指示に対する検索方法を前記知識ベースに基づいて
抽出する抽出手段と、前記抽出手段によって抽出された
前記検索方法各々の前記絞り込み率および検索コストを
算出するよう制御する手段とを設けたことを特徴とする
請求項1記載のデータベースシステム。2. A knowledge base for storing expertise of a search method in the table, an extracting means for extracting a search method for a search instruction requested by the user based on the knowledge base, and the extracting means. The database system according to claim 1, further comprising means for controlling to calculate the narrowing-down rate and the search cost of each of the extracted search methods.
クセスルートの決定方法を選択する選択手段と、前記選
択手段によって選択された前記決定方法に基づいて前記
絞り込み率算出手段と前記検索コスト算出手段と前記決
定手段とを夫々制御する手段とを設けたことを特徴とす
る請求項1または請求項2記載のデータベースシステ
ム。3. A selection means for selecting a method for determining the access route based on the user's instruction content, and the narrowing-down rate calculation means and the search cost calculation based on the determination method selected by the selection means. 3. The database system according to claim 1, further comprising means for controlling the means and the determining means, respectively.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3233991A JPH0554082A (en) | 1991-08-21 | 1991-08-21 | Data base system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3233991A JPH0554082A (en) | 1991-08-21 | 1991-08-21 | Data base system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0554082A true JPH0554082A (en) | 1993-03-05 |
Family
ID=16963835
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP3233991A Pending JPH0554082A (en) | 1991-08-21 | 1991-08-21 | Data base system |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0554082A (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2003504727A (en) * | 1999-07-02 | 2003-02-04 | トップティアー, イスラエル, リミテッド | Feasibility prediction of relational route |
| CN115146019A (en) * | 2021-03-31 | 2022-10-04 | 阿里巴巴新加坡控股有限公司 | Data retrieval method, device and distributed system |
| WO2025234102A1 (en) * | 2024-05-10 | 2025-11-13 | 株式会社Nttドコモ | Information output device and information output method |
-
1991
- 1991-08-21 JP JP3233991A patent/JPH0554082A/en active Pending
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2003504727A (en) * | 1999-07-02 | 2003-02-04 | トップティアー, イスラエル, リミテッド | Feasibility prediction of relational route |
| JP2009116898A (en) * | 1999-07-02 | 2009-05-28 | Sap Portals Israel Ltd | Relation path viability prediction |
| CN115146019A (en) * | 2021-03-31 | 2022-10-04 | 阿里巴巴新加坡控股有限公司 | Data retrieval method, device and distributed system |
| WO2025234102A1 (en) * | 2024-05-10 | 2025-11-13 | 株式会社Nttドコモ | Information output device and information output method |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3510042B2 (en) | Database management method and system | |
| JPH0675265B2 (en) | Information retrieval method and system | |
| KR101955376B1 (en) | Processing method for a relational query in distributed stream processing engine based on shared-nothing architecture, recording medium and device for performing the method | |
| JPH0554082A (en) | Data base system | |
| CN120123369A (en) | A big data query and export optimization method based on offset | |
| JPH08329101A (en) | Database system | |
| JP3183252B2 (en) | Database search system | |
| JPH0782429B2 (en) | How to merge multiple files | |
| JPH07319742A (en) | Physical deleting system for logically deleted data | |
| JP2636806B2 (en) | Index update method | |
| JPH06161844A (en) | Data base managing device | |
| JPH01248233A (en) | Data base retrieving device | |
| TW202024948A (en) | Fast established index system of cloud big-data database capable of greatly increasing the efficiency of index establishment by querying the data of the big-data database in the cloud | |
| JPH0635767A (en) | Data base system | |
| JPH04337867A (en) | Data base retrieval system | |
| JP3305782B2 (en) | Software standardization method and software product analysis method | |
| JPH03282841A (en) | Direct input/output processing system for variable length record | |
| CN121958304A (en) | A method for optimizing structured query language statements, a terminal device, and a storage medium. | |
| JPH06149635A (en) | Method for additional processing of record | |
| JPH0581330A (en) | Inquiry optimizing device of data base | |
| JPH0452967A (en) | And operation processing system for set file | |
| JPH0342773A (en) | Data base retrieving system | |
| JPH09190465A (en) | Method for referring to classified and stored information | |
| JPH04276828A (en) | Hypothesis management method for knowledge processing system | |
| JPS63172334A (en) | Data processing method of database system |