JPH0934760A - Device and method for optimizing retrieving instruction - Google Patents
Device and method for optimizing retrieving instructionInfo
- Publication number
- JPH0934760A JPH0934760A JP7186746A JP18674695A JPH0934760A JP H0934760 A JPH0934760 A JP H0934760A JP 7186746 A JP7186746 A JP 7186746A JP 18674695 A JP18674695 A JP 18674695A JP H0934760 A JPH0934760 A JP H0934760A
- Authority
- JP
- Japan
- Prior art keywords
- search
- optimizing
- structure information
- search instruction
- knowledge
- 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
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 search instruction optimizing apparatus used in a database system, and more particularly to conversion of search instructions.
【0002】[0002]
【従来技術およびその課題】今日、アプリケーションプ
ログラム上にデータベースシステムが読み出されて、検
索処理等が行われる場合がある。例えば、経理ソフトの
アプリケーションプログラムにおいて、データベースシ
ステムにアクセスすることによって、社員の平均年齢お
よび平均年収データを取得して、経理処理をすることが
できる。2. Description of the Related Art Today, a database system may be read on an application program to perform a search process or the like. For example, in an application program of accounting software, by accessing a database system, it is possible to obtain average age and average annual income data of employees and perform accounting processing.
【0003】このアプリケーションプログラム上で、あ
る検索処理を行う場合に、そのSQL文をどのように記
述するかによって、検索効率が変わる。これは、データ
ベースシステムの処理特性がデータベースシステム毎に
異なるので、SQL文の記述を見直すことによって、検
索効率が向上するからである。この処理特性とは、複数
の処理内容のSQL文については記述順序にかかわりな
く、ある処理が先に行われる等の処理手順の特性をい
う。また、同じデータベースシステムであっても、デー
タの構造(例えば、インデックスが作成されているか否
か、また各テーブルの行数など)によっては、同じ内容
の検索を行うSQL文であっても、検索速度が異なる場
合もある。When performing a search process on this application program, the search efficiency changes depending on how the SQL statement is described. This is because the processing characteristics of the database system are different for each database system, and the search efficiency is improved by reviewing the description of the SQL statement. This processing characteristic refers to a characteristic of a processing procedure such that a certain processing is first performed for SQL statements having a plurality of processing contents regardless of the description order. Even in the same database system, depending on the data structure (for example, whether or not an index has been created, the number of rows in each table, etc.), even if it is an SQL statement that searches for the same content, The speed may be different.
【0004】したがって、一般には、ある検索命令を実
行するSQL文を決定した後、当該SQL文のチューニ
ングが行われる。Therefore, generally, after the SQL statement to execute a search instruction is determined, the SQL statement is tuned.
【0005】しかしながら、このようなチューニングは
容易ではない。なぜなら、SQL文の表記をどのように
すれば、高速検索ができるかは当該データベースシステ
ムの特性(構造情報を含む)を理解してなければならな
いからである。したがって、前記特性を理解していない
初心者には前記チューニングは不可能であった。However, such tuning is not easy. This is because it is necessary to understand the characteristics (including structural information) of the database system as to how the SQL statement can be used for high-speed retrieval. Therefore, the tuning is impossible for a beginner who does not understand the characteristics.
【0006】この発明は、データベースシステムの特性
に応じて、与える検索命令の記述決定を簡易且つ容易に
行うこと、さらにはアプリケーションソフト設計開発に
おける開発工程を削減することを目的とする。特に、デ
ータベースシステムの構造情報に応じて与える検索命令
の記述決定を簡易且つ容易に行うことを目的とする。An object of the present invention is to easily and easily determine the description of a given search command according to the characteristics of a database system, and further to reduce the development process in application software design and development. In particular, it is an object to simply and easily determine the description of a search command given according to the structural information of the database system.
【0007】[0007]
【0008】[0008]
【課題を解決するために案出した技術思想】請求項1の
検索命令最適化装置においては、より高速処理が可能な
検索命令に変換する為に、検索命令を最適化するための
変換知識を記憶しておき、与えられた検索命令を前記変
換知識に当てはめて前記検索命令を変換するようにし
た。In the search instruction optimizing apparatus according to the first aspect of the present invention, in order to convert the search instruction into a search instruction that can be processed at a higher speed, conversion knowledge for optimizing the search instruction is provided. The search command is stored and applied, and the given search command is applied to the conversion knowledge to convert the search command.
【0009】すなわち、発明の全体構成を示す図である
図1に記載しているように、請求項1の検索命令最適化
装置においては、検索命令を最適化するための変換知識
を記憶する変換知識記憶手段、与えられた検索命令を前
記変換知識に当てはめ、変換可能であると判断した場合
は、前記検索命令を変換して最適化検索命令を出力する
最適化手段、を備えたことを特徴とする。That is, as described in FIG. 1, which is a diagram showing the overall configuration of the invention, in the search instruction optimizing apparatus of claim 1, a conversion for storing conversion knowledge for optimizing the search instruction. A knowledge storage means; and an optimization means for applying a given search command to the conversion knowledge and converting the search command to output an optimized search command when it is determined that conversion is possible. And
【0010】請求項2の検索命令最適化装置において
は、構造情報取得命令が与えられると、データベースシ
ステムから構造情報を取得して、前記最適化手段に出力
する構造情報取得手段を備え、前記最適化手段は、当該
データベースシステムの構造情報が必要であると判断し
た場合には、前記構造情報取得命令を出力し、前記検索
命令に加えて前記構造情報取得手段で取得される構造情
報を用いて、前記変換可能か否か判断することを特徴と
する。According to a second aspect of the present invention, there is provided a search instruction optimizing apparatus comprising structure information obtaining means for obtaining structure information from a database system and outputting it to the optimizing means when a structure information obtaining instruction is given. When it is determined that the structure information of the database system is necessary, the converting unit outputs the structure information acquisition command, and uses the structure information acquired by the structure information acquisition unit in addition to the search command. It is characterized by determining whether or not the conversion is possible.
【0011】請求項3の検索命令最適化装置において
は、前記変換知識は、メンバシップ関数およびルールか
ら構成されており、前記最適化手段は、ファジィ推論に
よって前記検索命令を変換することを特徴とする。According to a third aspect of the present invention, in the retrieval instruction optimizing device, the conversion knowledge comprises a membership function and a rule, and the optimizing means transforms the retrieval instruction by fuzzy inference. To do.
【0012】請求項4の検索命令最適化装置において
は、前記最適化手段は、前記検索命令で検索対象となる
表について、列の選択性および行数に基づいて、インデ
ックスを使用して検索すべきか否か判断するとともに、
インデックスを使用して検索すべきであると判断した場
合には、前記検索命令をインデックス検索可能となるよ
うに変換することを特徴とする。In the search instruction optimizing apparatus according to the present invention, the optimizing means should search the table to be searched by the search instruction using the index based on the column selectivity and the number of rows. While judging whether or not
When it is determined that the index should be used for the search, the search command is converted so that the index search can be performed.
【0013】請求項5の検索命令最適化方法において
は、与えられた検索命令を、予め記憶しておいた変換知
識に当てはめて、変換可能である場合は、前記検索命令
を変換して最適化することを特徴とする。In the search instruction optimizing method of claim 5, the given search instruction is applied to conversion knowledge stored in advance, and if conversion is possible, the search instruction is converted and optimized. It is characterized by doing.
【0014】請求項6の検索命令最適化方法において
は、データベースシステムの構造情報が必要であると判
断した場合には、データベースシステムからその構造情
報を取得し、前記検索命令に加えて、さらに前記取得さ
れた構造情報を用いることを特徴とする。In the search command optimizing method of claim 6, when it is determined that the structure information of the database system is necessary, the structure information is acquired from the database system, and in addition to the search command, the structure information is further acquired. It is characterized by using the acquired structural information.
【0015】請求項7の検索命令最適化方法において
は、前記変換知識は、メンバシップ関数およびルールか
ら構成されており、前記変換可能か否かの判断を、ファ
ジィ推論を用いて行うことを特徴とする。According to a seventh aspect of the present invention, in the search instruction optimizing method, the conversion knowledge is composed of membership functions and rules, and whether or not the conversion is possible is determined by using fuzzy inference. And
【0016】請求項8の検索命令最適化方法において
は、前記検索命令で検索対象となる表について、列の選
択性および行数に基づいて、インデックスを使用して検
索すべきか否か判断するとともに、インデックスを使用
して検索すべきであると判断した場合には、前記検索命
令をインデックス検索可能となるように変換することを
特徴とする。In the search instruction optimizing method according to claim 8, it is determined whether or not the table to be searched by the search instruction should be searched using the index based on the column selectivity and the number of rows. When it is determined that a search should be performed using the index, the search command is converted so that the index search can be performed.
【0017】請求項9のプログラムを記憶した記憶媒体
においては、請求項1ないし請求項8のいずれかの装置
又は方法を、コンピュータを用いて実現することを特徴
とする。According to a ninth aspect of the present invention, there is provided a storage medium storing the program, wherein the apparatus or method according to any one of the first to eighth aspects is realized by using a computer.
【0018】[0018]
【用語の定義】課題を解決するために案出した技術思想
を表現するのに用いた請求項の用語の概念を、以下のよ
うに定義するとともに、その用語と実施例との関係につ
いて説明する。[Definition of terms] The concept of terms used in the claims used to express the technical idea devised to solve the problems is defined as follows, and the relationship between the terms and the embodiments will be described. .
【0019】「データベースシステムの構造情報」:構
造情報とは、変換対象の検索命令で指定される処理対象
に関する情報をいう。実施例では、変換対象のSQLで
参照されるテーブルに関するテーブル情報、カラムに関
するカラム情報、および当該カラムに関するインデック
ス情報に該当する。この構造情報には、個別必要構造情
報を含む。個別必要構造情報とは、当該構造情報のう
ち、当該変換知識の条件に合致するか否かを判断するの
に必要なデータをいう。"Structural information of database system": Structural information means information about a processing target specified by a search command of a conversion target. In the embodiment, it corresponds to the table information about the table referred to in the conversion target SQL, the column information about the column, and the index information about the column. This structural information includes individual required structural information. The individually necessary structure information is data necessary for determining whether or not the structure information meets the condition of the conversion knowledge.
【0020】「列の選択性」:列の行数/ユニークデー
タ数で求められる値である。かかる値が大きいほど、列
の選択性が小さく、値が小さいほど、列の選択性が大き
くなる。"Column selectivity": A value obtained by the number of rows in a column / the number of unique data. The larger the value, the smaller the column selectivity, and the smaller the value, the greater the column selectivity.
【0021】[0021]
【作用および発明の効果】請求項1、請求項5の検索命
令最適化装置又はその方法においては、与えられた検索
命令を、予め記憶しておいた変換知識に当てはめて、変
換可能である場合は、前記検索命令を変換して最適化す
る。したがって、より高速処理が可能な検索命令を得る
ことができる。これにより、データベースの処理の理解
が浅い者であっても、熟練者と同様の検索命令を作成す
ることができる。すなわち、データベースの処理特性に
ついてSQL文の調整の脱熟練化および半自動化、さら
には設計開発工程を削減することができる。In the search instruction optimizing apparatus or method according to claims 1 and 5, when the given search instruction is applied to the conversion knowledge stored in advance, conversion is possible. Converts and optimizes the search command. Therefore, it is possible to obtain a search command that enables higher speed processing. As a result, even a person who has a poor understanding of database processing can create a search command similar to that of a skilled person. That is, it is possible to reduce the skill of adjusting SQL statements regarding the processing characteristics of the database, semi-automating, and further reduce the design development process.
【0022】請求項2、請求項6の検索命令最適化装置
又はその方法においては、データベースシステムの構造
情報が必要であると判断した場合には、データベースシ
ステムからその構造情報を取得し、前記検索命令に加え
て、さらに前記取得された構造情報を用いる。したがっ
て、データベースシステムの構造に適合した検索命令を
得ることができる。これにより、より高速処理が可能と
なる。In the search instruction optimizing apparatus or the method thereof according to claims 2 and 6, when it is determined that the structure information of the database system is necessary, the structure information is acquired from the database system and the search is performed. In addition to the command, the acquired structural information is further used. Therefore, it is possible to obtain a search command suitable for the structure of the database system. This enables higher speed processing.
【0023】請求項3、請求項7の検索命令最適化装置
又はその方法においては、前記変換知識は、メンバシッ
プ関数およびルールから構成されており、前記変換可能
か否かの判断を、ファジィ推論を用いて行う。したがっ
て、複数の条件を満たす推論を人間の感覚にあった知識
で記述することができるので、知識の構築およびその修
正が容易となる。In the search instruction optimizing apparatus or the method thereof according to claims 3 and 7, the conversion knowledge is composed of membership functions and rules, and the fuzzy inference is used to judge whether the conversion is possible or not. Using. Therefore, since inference that satisfies a plurality of conditions can be described with knowledge that matches the human sense, knowledge can be easily constructed and modified.
【0024】請求項4、請求項8の検索命令最適化装置
又はその方法においては、前記検索命令で検索対象とな
る表について、列の選択性および行数に基づいて、イン
デックスを使用して検索すべきか否か判断するととも
に、インデックスを使用して検索すべきであると判断し
た場合には、前記検索命令をインデックス検索可能とな
るように変換する。したがって、列の選択性および行数
を考慮して、前記検索命令を最適化することができる。
これにより、データベースの処理特性についてSQL文
の調整の脱熟練化および半自動化、さらには設計開発工
程を削減することができる。According to another aspect of the present invention, there is provided a search instruction optimizing apparatus or method thereof, wherein a table to be searched by the search instruction is searched using an index based on column selectivity and the number of rows. If it is determined that the search should be performed using the index, it is converted so that the index search can be performed. Therefore, the search instruction can be optimized in consideration of column selectivity and the number of rows.
As a result, it is possible to reduce the need for de-skilling and semi-automating the adjustment of SQL statements regarding the processing characteristics of the database, and further reduce the design development process.
【0025】[0025]
【実施例】本発明の一実施例を図面に基づいて説明す
る。図1に示す検索命令最適化装置1は、変換知識記憶
手段7、最適化手段3、および構造情報取得手段5を備
えている。An embodiment of the present invention will be described with reference to the drawings. The search instruction optimizing device 1 shown in FIG. 1 includes a conversion knowledge storing means 7, an optimizing means 3, and a structure information acquiring means 5.
【0026】変換知識記憶手段7は、検索命令を最適化
するための変換知識を記憶する。構造情報取得手段5
は、データベースシステム9と接続されている。データ
ベースシステム9は、通常のリレーショナルデータベー
スシステムであり、複数のデータを記憶するデータベー
ス部およびこのデータベース部を管理するデータベース
マネイジメントシステムを備えている。構造情報取得手
段5は、構造情報取得命令が与えられると、データベー
スシステム9から当該データベースシステムの構造情報
を取得して、最適化手段3に出力する。The conversion knowledge storage means 7 stores conversion knowledge for optimizing the search command. Structural information acquisition means 5
Is connected to the database system 9. The database system 9 is an ordinary relational database system, and includes a database unit that stores a plurality of data and a database management system that manages this database unit. When the structural information acquisition command is given, the structural information acquisition unit 5 acquires the structural information of the database system from the database system 9 and outputs it to the optimization unit 3.
【0027】最適化手段3は、前記変換可能か否か判断
する際に、当該データベースシステムの構造情報が必要
であると判断した場合には、前記構造情報取得命令を出
力し、前記検索命令に加えて前記構造情報取得手段で取
得される構造情報を用いて、前記変換可能か否か判断す
る。すなわち、与えられた検索命令および構造情報取得
手段5から与えられた構造情報を、変換知識記憶手段7
に記憶されている変換知識に当てはめてる。そして、変
換可能であると判断した場合は、与えられた検索命令を
変換して最適化検索命令として出力する。When the optimizing means 3 determines that the structural information of the database system is necessary when determining whether the conversion is possible, the optimizing means 3 outputs the structural information acquisition command and outputs the structural information to the search command. In addition, it is determined whether the conversion is possible by using the structure information acquired by the structure information acquisition means. That is, the given search command and the structural information given from the structural information acquisition means 5 are converted into the conversion knowledge storage means 7.
Applied to the conversion knowledge stored in. When it is determined that conversion is possible, the given search command is converted and output as an optimized search command.
【0028】本実施例においては、変換知識記憶手段7
に記憶されている変換知識は、メンバシップ関数および
ルールから構成されている。そして最適化手段3は、フ
ァジィ推論によって検索命令を変換する。In this embodiment, the conversion knowledge storage means 7
The transformation knowledge stored in is composed of membership functions and rules. Then, the optimizing means 3 converts the search instruction by fuzzy inference.
【0029】図2は、図1に示す検索命令最適化装置1
をCPUを用いて実現したハードウェア構成の一例を示
す。FIG. 2 shows the retrieval instruction optimizing apparatus 1 shown in FIG.
1 shows an example of a hardware configuration realized by using a CPU.
【0030】検索命令最適化装置1は、CPU23、メ
モリ27、ハードディスク26、CRT28、キーボー
ド28、FDD25、入出力インターフェイス32およ
びバスライン29を備えている。The search instruction optimizing device 1 includes a CPU 23, a memory 27, a hard disk 26, a CRT 28, a keyboard 28, an FDD 25, an input / output interface 32 and a bus line 29.
【0031】CPU23は、ハードディスク26に記憶
された制御プログラムにしたがいバスライン29を介し
て、各部を制御する。The CPU 23 controls each unit via the bus line 29 according to a control program stored in the hard disk 26.
【0032】この制御プログラムは、FDD25を介し
て、プログラムが記憶されたフレキシブルディスクから
読み出されてハードディスク26に記憶された(インス
トールされた)ものである。ハードディスク26には後
述する修正知識(図6、図7参照)が記憶される。メモ
リ27には演算結果等が記憶される。CRT28には、
CPU23が処理した修正案等が表示される。This control program is read from the flexible disk storing the program via the FDD 25 and stored (installed) in the hard disk 26. The hard disk 26 stores correction knowledge (see FIGS. 6 and 7) described later. The memory 27 stores the calculation result and the like. CRT28 has
The correction plan processed by the CPU 23 is displayed.
【0033】入出力インターフェイス32には、データ
ベースマネジメントシステム(DBMS)34が接続さ
れている。データベース部35には、各種のデータとと
もに、このデータベースシステムの論理構造および物理
構造に関する情報、例えば、テーブルが記憶されている
アドレス、テーブルにインデックスがどのように付与さ
れているか等を記憶する。A database management system (DBMS) 34 is connected to the input / output interface 32. The database unit 35 stores various types of data, as well as information about the logical structure and physical structure of the database system, for example, addresses at which tables are stored, how indexes are added to tables, and the like.
【0034】なお、本実施例では、データベースシステ
ムとして、オラクルデータベースシステム(オラクル社
製)を採用し、オペレーティングシステムとして、DG/U
Xオペレーティングシステム(データゼネラル社製)を
採用した。In this embodiment, an Oracle database system (manufactured by Oracle) is used as the database system and DG / U is used as the operating system.
The X operating system (manufactured by Data General) was adopted.
【0035】つぎに、図3を用いて、ハードディスク2
6に記憶されているプログラムについて、説明する。Next, referring to FIG. 3, the hard disk 2
The program stored in 6 will be described.
【0036】まず、CPU23は、処理対象知識番号i
を初期化する(図3ステップST1)。つぎに、CPU
23は、対象となるSQL文を読み込み、メモリ27に
記憶する(ステップST3)。ここでは、図5AのSQ
L文が読み込まれたものとして説明する。First, the CPU 23 determines the processing target knowledge number i
Are initialized (step ST1 in FIG. 3). Next, CPU
23 reads the target SQL sentence and stores it in the memory 27 (step ST3). Here, SQ of FIG. 5A
It is assumed that the L sentence has been read.
【0037】CPU23は、メモリ27に、i番目の修
正知識の読み込みを行なう(ステップST5)。修正知
識は図6に示すように、知識ID、データベース構造情
報の要否、SQL文修正知識から構成されている。この
場合i=1なので、CPU23は、知識ID0001の
修正知識をメモリ27に読み込む。The CPU 23 reads the i-th correction knowledge into the memory 27 (step ST5). As shown in FIG. 6, the correction knowledge is composed of a knowledge ID, necessity of database structure information, and SQL sentence correction knowledge. In this case, since i = 1, the CPU 23 reads the corrected knowledge of the knowledge ID 0001 into the memory 27.
【0038】つぎに、CPU23は、図5Aに示すSQ
L文が、図6に示す知識ID0001の修正知識に該当
するか否かを判断する(図3ステップST10)。Next, the CPU 23 executes the SQ shown in FIG. 5A.
It is determined whether the L sentence corresponds to the corrected knowledge of the knowledge ID 0001 shown in FIG. 6 (step ST10 in FIG. 3).
【0039】ステップST10の処理について、図4を
用いて詳細に説明する。まず、CPU23は、当該知識
ID0001の修正知識が、データベース構造情報が必
要な修正知識か否か判断する(図4ステップST2
1)。この場合、図6に示すように、知識ID0001
の修正知識については、データベース構造情報が「要」
と記憶されているので、ステップST23に進む。ステ
ップST23では、CPU23は、既にデータベース構
造情報を抽出済か否か判断する。この場合、データベー
ス構造情報を未だ抽出していないので、ステップST2
5に進む。The process of step ST10 will be described in detail with reference to FIG. First, the CPU 23 determines whether the correction knowledge of the knowledge ID 0001 is the correction knowledge that requires the database structure information (step ST2 in FIG. 4).
1). In this case, as shown in FIG. 6, the knowledge ID 0001
For the correction knowledge of, the database structure information is "necessary"
Since it is stored, the process proceeds to step ST23. In step ST23, the CPU 23 determines whether or not the database structure information has already been extracted. In this case, since the database structure information has not yet been extracted, step ST2
Go to 5.
【0040】ステップST25では、CPU23は、図
2に示す入出力インタフェイス32を介してDBMS3
4にアクセスして、データベース部35のデータベース
ディクショナリ(図示せず)から、データベース構造情
報を抽出する。In step ST25, the CPU 23 uses the input / output interface 32 shown in FIG.
4 to extract the database structure information from the database dictionary (not shown) of the database unit 35.
【0041】データベース構造情報とは、変換対象のS
QL文で指定される処理対象に関するデータをいう。具
体的には、変換対象のSQLで参照されるテーブルに関
するテーブル情報、カラムに関するカラム情報、および
当該カラムに関するインデックス情報である。The database structure information is the S to be converted.
It refers to the data related to the processing target specified in the QL statement. Specifically, it is table information regarding a table referred to in the conversion target SQL, column information regarding a column, and index information regarding the column.
【0042】本実施例においては、テーブル情報とし
て、テーブル名、テーブルオーナー名、およびテーブル
の行数列を採用した。また、カラム情報として、カラム
名、テーブル名、テーブルオーナー名、データ型、およ
びユニークデータ数を採用した。また、インデックス情
報として、インデックス名、インデックスオーナー名、
カラム名、テーブルオーナー名およびカラム順序を採用
した すなわち、図5AのSQL文については、図9A,B,
Cに示すようなテーブル情報、カラム情報、およびイン
デックス情報が得られた。なお、図9Cに示すインデッ
クス情報については、カラム「NAME」が存在しないの
は、当該カラムにはインデックスが付加されていないか
らである。In this embodiment, the table name, the table owner name, and the row number sequence of the table are adopted as the table information. In addition, the column name, the table name, the table owner name, the data type, and the number of unique data are adopted as the column information. Also, as index information, index name, index owner name,
A column name, a table owner name, and a column order are adopted. That is, for the SQL statement in FIG. 5A,
The table information, the column information, and the index information as shown in C are obtained. Regarding the index information shown in FIG. 9C, the column “NAME” does not exist because no index is added to the column.
【0043】なお、図9Bにおいて、データ型「NUMBE
R」とは、数字型のデータをいい、データ型「VARCHER
2」とは、文字列型のデータをいう。また、ユニークデ
ータ数とは、当該カラムのデータについて、異なる値の
有する行が何行あるかを示す値である。In FIG. 9B, the data type "NUMBE
“R” means numeric type data, and the data type “VARCHER
"2" refers to character string type data. The number of unique data is a value indicating how many rows have different values in the data of the column.
【0044】本実施例においては、オラクルデータベー
スを採用したので、図8Aに示すSQL文によって図9
Aに示すテーブル情報、図8Bに示すSQL文によって
図9Bに示すカラム情報、図8Cに示すSQL文によっ
て図9Cに示すインデックス情報を得ることができる。In the present embodiment, since the Oracle database is adopted, the SQL statement shown in FIG.
The table information shown in A, the SQL statement shown in FIG. 8B can obtain the column information shown in FIG. 9B, and the SQL statement shown in FIG. 8C can obtain the index information shown in FIG. 9C.
【0045】つぎに、CPU23は、図5Aに示すSQ
L文が、図6に示す知識ID0001の修正知識の条件
を満足するか否かを判断する(図4ステップST2
7)。Next, the CPU 23 executes the SQ shown in FIG. 5A.
It is determined whether or not the L sentence satisfies the condition of the corrected knowledge of the knowledge ID 0001 shown in FIG. 6 (step ST2 in FIG. 4).
7).
【0046】図6に示す知識ID0001の修正知識の
条件は、以下の3つである。The conditions for the corrected knowledge of the knowledge ID 0001 shown in FIG. 6 are the following three.
【0047】条件(1)SELECTコマンドのWHERE句中の式が
OR論理演算子で結ばれている、 条件(2)OR論理演算子で結ばれた各式の列にインデック
スが付与されている、 条件(3)サブ知識S1が真 図5Aに示すSQL文について、かかる3つの条件を満
たしているかを判断する。まず、条件(1)については、W
HERE NAME_ID=100 OR SALARY=250,000と、満たしてい
る。条件2については、図9Cに示す様に「NAME_ID」
および「SALARY」については、インデックスが付与され
ており、満たしている。条件3については、図7に示す
サブ知識1が真か否か判断する。本実施例においては、
かかる判断は、以下に示すように、ルールおよびメンバ
ーシップ関数を用いて、ファジィ推論することにより判
断するようにした。Condition (1) The expression in the WHERE clause of the SELECT command is
Condition (2) Connected by OR logical operator, condition (2) Index is added to each expression sequence connected by OR logical operator, Condition (3) Sub-knowledge S1 is true About SQL statement shown in FIG. 5A , It is determined whether these three conditions are satisfied. First, regarding condition (1), W
HERE NAME_ID = 100 OR SALARY = 250,000, which is satisfied. Regarding condition 2, as shown in Fig. 9C, "NAME_ID"
And, "SALARY" is indexed and satisfied. Regarding condition 3, it is determined whether or not the sub-knowledge 1 shown in FIG. 7 is true. In this embodiment,
As shown below, such a judgment is made by making a fuzzy inference using a rule and a membership function.
【0048】具体的には以下の様にして決定される。図
10に示すルール、図11A,Bに示す前件部のメンバ
シップ関数、および図11Cに示す後件部のメンバシッ
プ関数を用いて、各ルールについて、前件部の適合度を
求める。この前件部の適合度に基づき後件部の適合度を
求める。全てのルール(この場合2つ)についての後件
部の処理をした後に、後件部処理によって得られた各ル
ールの後件部メンバシップ関数を合成して合成メンバシ
ップ関数を生成し、生成した合成メンバシップ関数に対
して重心法等によるデファジファイを行い、真か否か判
断する。Specifically, it is determined as follows. Using the rules shown in FIG. 10, the membership function of the antecedent part shown in FIGS. 11A and 11B, and the membership function of the consequent part shown in FIG. 11C, the suitability of the antecedent part is obtained for each rule. The suitability of the consequent part is calculated based on the suitability of the antecedent part. After processing the consequent part for all rules (two in this case), combine the consequent part membership functions of each rule obtained by the consequent part process to generate a combined membership function, and generate The synthesized membership function is subjected to defuzzification by the center of gravity method or the like to determine whether it is true or not.
【0049】ここで、列の選択性とは、以下の式によっ
て求めることが出来る。Here, the column selectivity can be obtained by the following formula.
【0050】 列の選択性=列の行数/ユニークデータ数・・・(式1) 具体的に説明すると、この場合、列「NAME_ID」の選択
性は、テーブル行数が80,000(図9A参照)であ
り、ユニークデータ数も80,000である(図9B参
照)ので、列「NAME_ID」の選択性=1となる。この場
合、図11Aに示すメンバーシップ関数に当てはめる
と、列「NAME_ID」について、「列の選択性が大」の適
合度が1であることが分かる。また、テーブルの行数は
80,000であるので図9Bに示すメンバーシップ関
数に当てはめると、「テーブルの行数が大」の適合度は
0.6、「テーブルの行数小」の適合度は0.3とな
る。Column Selectivity = Number of Column Rows / Number of Unique Data (Equation 1) Specifically, in this case, the selectivity of the column “NAME_ID” is 80,000 (table 9A) and the number of unique data is 80,000 (see FIG. 9B), the selectivity of the column “NAME_ID” = 1. In this case, when applied to the membership function shown in FIG. 11A, it can be seen that the degree of suitability of “high column selectivity” is 1 for the column “NAME_ID”. Also, since the number of rows in the table is 80,000, when the membership function shown in FIG. 9B is applied, the goodness of fit of “large number of rows of table” is 0.6 and the goodness of fit of “small row of table” Is 0.3.
【0051】また、列「SALARY」の選択性は、テーブル
行数が80,000(図9A参照)であり、ユニークデ
ータ数は10,000である(図9B参照)ので、列
「SALARY」の選択性=8となる。この場合、図11Aに
示すメンバーシップ関数に当てはめると、列「SALARY」
について、「列の選択性が大」の適合度が1であること
が分かる。The selectivity of the column “SALARY” is 80,000 table rows (see FIG. 9A) and the unique data number is 10,000 (see FIG. 9B). Selectivity = 8. In this case, applying the membership function shown in FIG. 11A, the column "SALARY"
It can be seen that the conformity of “high column selectivity” is 1.
【0052】また、テーブルの行数は80,000であ
るので図11Bに示すメンバーシップ関数に当てはめる
と、「テーブルの行数が大」の適合度は0.6、「テー
ブルの行数小」の適合度は0.3となる。つぎに、図1
0に示す各ルールについて、後件部の適合度を求める。
この場合、ルール1については、適合度0.6、ルール
2については、適合度0.3となる。この生成した合成
メンバシップ関数に対して重心法によるデファジファイ
を行い、真であると判断する。Since the number of rows in the table is 80,000, when the membership function shown in FIG. 11B is applied, the degree of conformity for "large number of rows in table" is 0.6 and "small number of rows in table". The degree of conformity of is 0.3. Next, FIG.
For each rule shown in 0, the conformance of the consequent part is obtained.
In this case, the rule 1 has a goodness of fit of 0.6, and the rule 2 has a goodness of fit of 0.3. The generated composite membership function is defuzzified by the center of gravity method, and is determined to be true.
【0053】したがって、図5Aに示すSQL文につい
て、前記3つの条件を満たしているので、図4ステップ
ST27にて条件を満たすとして、図3ステップST1
5に進む。Therefore, since the SQL sentence shown in FIG. 5A satisfies the above three conditions, it is determined that the condition is satisfied in step ST27 in FIG. 4 and step ST1 in FIG.
Go to 5.
【0054】ステップST15では、CPU23は、修
正案を作成する。この場合、図6に示す知識ID000
1は、条件を満たせば、「UNION集合演算子を用いたS
QL文に変換する」という知識であるので、図5Aに示
すSQL文を「UNION」集合演算子を用いたSQL文を
用いて、図10Aに示すように変換した修正案を作成す
る。CPU23は、この修正案をメモリ27に記憶する
とともに、CRT28に表示する(図3ステップST1
7)。このようにして、SQL文の変換が行なわれる。At step ST15, the CPU 23 creates a correction plan. In this case, the knowledge ID 000 shown in FIG.
If the condition 1 is satisfied, "S using the UNION set operator
Since it is the knowledge of "convert to QL sentence", the SQL sentence shown in FIG. 5A is converted into a correction plan as shown in FIG. 10A by using an SQL sentence using a "UNION" set operator. The CPU 23 stores the correction plan in the memory 27 and displays it on the CRT 28 (step ST1 in FIG. 3).
7). In this way, the SQL sentence is converted.
【0055】図5Aに示すSQL文においては、列「NA
ME_ID」および「SALARY」については、図9Cに示すよ
うにインデックスが付与されているので、図12Aに示
すように、双方のWHERE句をばらばらにすることによっ
て、インデックス検索(インデックスを用いた検索)を
することができる。これにより高速処理が可能となる。In the SQL statement shown in FIG. 5A, the column "NA
As for ME_ID ”and“ SALARY ”, indexes are added as shown in FIG. 9C. Therefore, as shown in FIG. 12A, an index search (search using an index) is performed by separating both WHERE clauses. You can This enables high-speed processing.
【0056】なお、本実施例においては、ステップST
23で、CPU23は、既にデータベース構造情報を抽
出済か否か判断するようにしている。これにより、一旦
データベース構造情報を抽出した場合には、再度読み出
しの時間が不要となり、より高速処理が可能となる。In this embodiment, step ST
At 23, the CPU 23 determines whether or not the database structure information has already been extracted. As a result, once the database structure information has been extracted, the time for re-reading is unnecessary, and higher speed processing is possible.
【0057】つぎに、図5Bに示すSQL文が与えられ
た場合の処理について説明する。CPU23は、処理対
象知識番号iを初期化する(図3ステップST1)。つ
ぎに、CPU23は、対象となる図5Bに示すSQL文
を読み込み、メモリ27に記憶する(ステップST
3)。そして、i番目の修正知識の読み込みを行なう
(ステップST5)。この場合i=1なので、CPU2
3は、知識ID0001の修正知識をメモリ27に読み
込む。Next, the processing when the SQL sentence shown in FIG. 5B is given will be described. The CPU 23 initializes the processing target knowledge number i (step ST1 in FIG. 3). Next, the CPU 23 reads the target SQL statement shown in FIG. 5B and stores it in the memory 27 (step ST
3). Then, the i-th correction knowledge is read (step ST5). In this case, i = 1, so CPU2
3 reads the correction knowledge of the knowledge ID 0001 into the memory 27.
【0058】つぎに、CPU23は、図5Bに示すSQ
L文が、図6に示す知識ID0001の修正知識に該当
するか否かを判断する(図3ステップST10)。ステ
ップST10の判断においては、既に説明したように、
CPU23は、当該知識ID0001の修正知識が、デ
ータベース構造情報が必要な修正知識か否か判断する
(図4ステップST21)。Next, the CPU 23 executes the SQ shown in FIG. 5B.
It is determined whether the L sentence corresponds to the corrected knowledge of the knowledge ID 0001 shown in FIG. 6 (step ST10 in FIG. 3). In the judgment of step ST10, as already described,
The CPU 23 determines whether the correction knowledge of the knowledge ID 0001 is the correction knowledge that requires the database structure information (step ST21 in FIG. 4).
【0059】この場合、図6に示すように、知識ID0
001の修正知識については、データベース構造情報が
「要」と記憶されているので、ステップST23に進
む。ステップST23では、CPU23は、既にデータ
ベース構造情報を抽出済か否か判断する。この場合、デ
ータベース構造情報を未だ抽出していないので、ステッ
プST25に進み、データベース構造情報を抽出する。In this case, as shown in FIG. 6, the knowledge ID 0
Regarding the correction knowledge of 001, since the database structure information is stored as "necessary", the process proceeds to step ST23. In step ST23, the CPU 23 determines whether or not the database structure information has already been extracted. In this case, since the database structure information has not yet been extracted, the process proceeds to step ST25 and the database structure information is extracted.
【0060】つぎに、CPU23は、図5Bに示すSQ
L文が、図6に示す知識ID0001の修正知識の条件
を満足するか否かを判断する(図4ステップST2
7)。この場合、図5Bに示すSQL文について、前記
3つの条件を全て満たしているわけではないので、図4
ステップST27にて条件を満たさないとして、図3ス
テップST11に進む。ステップST11では、CPU
23は、iが最終が否か判断する。この場合、最終でな
いので、ステップST12に進み、iをインクリメント
し、ステップST5に進み、i番目、すなわち、ID0
002の修正知識を読み出す。Next, the CPU 23 executes the SQ shown in FIG. 5B.
It is determined whether or not the L sentence satisfies the condition of the corrected knowledge of the knowledge ID 0001 shown in FIG. 6 (step ST2 in FIG. 4).
7). In this case, the SQL statement shown in FIG. 5B does not meet all the above three conditions, and therefore the SQL statement shown in FIG.
If the condition is not satisfied in step ST27, the process proceeds to step ST11 in FIG. In step ST11, the CPU
23 determines whether i is the last. In this case, since it is not the final one, the process proceeds to step ST12, i is incremented, the process proceeds to step ST5, i-th, that is, ID0.
The correction knowledge of 002 is read.
【0061】CPU23は、図5Bに示すSQL文が、
図6に示す知識ID0002の修正知識に該当するか否
かを判断する(図3ステップST10)。ステップST
10の判断においては、既に説明したように、CPU2
3は、当該知識ID0002の修正知識が、データベー
ス構造情報が必要な修正知識か否か判断する(図4ステ
ップST21)。The CPU 23 executes the SQL statement shown in FIG.
It is determined whether or not it corresponds to the correction knowledge of the knowledge ID 0002 shown in FIG. 6 (step ST10 in FIG. 3). Step ST
In the judgment of 10, as described above, the CPU 2
3 determines whether the correction knowledge of the knowledge ID 0002 is the correction knowledge that requires the database structure information (step ST21 in FIG. 4).
【0062】この場合、図6に示すように、知識ID0
002の修正知識については、データベース構造情報が
「不要」と記憶されているので、ステップST27に進
む。ステップST27では、CPU23は、図5Bに示
すSQL文が、図6に示す知識ID0002の修正知識
の条件を満足するか否かを判断する(図4ステップST
27)。この場合、図5Bに示すSQL文においては、
SELECTコマンドのHAVING句においてグループ関数が指定
されていない。したがって、知識ID0002の修正知
識の条件を満足するので、図4ステップST27から図
3ステップST15に進み、修正案を作成し、表示する
(ステップST17)。この様にして、図5Bに示すS
QL文は、図12Bに示すSQL文に変換される。In this case, as shown in FIG. 6, the knowledge ID 0
Regarding the correction knowledge of 002, since the database structure information is stored as "unnecessary", the process proceeds to step ST27. In step ST27, the CPU 23 determines whether or not the SQL statement shown in FIG. 5B satisfies the condition of the correction knowledge of the knowledge ID 0002 shown in FIG. 6 (step ST in FIG. 4).
27). In this case, in the SQL sentence shown in FIG. 5B,
No group function is specified in the HAVING clause of the SELECT command. Therefore, since the condition of the correction knowledge of the knowledge ID 0002 is satisfied, the process proceeds from step ST27 of FIG. 4 to step ST15 of FIG. 3 to create and display the correction plan (step ST17). In this way, S shown in FIG.
The QL sentence is converted into the SQL sentence shown in FIG. 12B.
【0063】なお、HAVING句をWHERE句に変換すると、
検索処理時間が短くなるのは、当該オラクルデータベー
スシステムの特性による。すなわち、オラクルデータベ
ースシステムにおいては、図5Bに示すSQL文が与え
られると、テーブル「ADDRESS」のカラム「LO
CATION」について、グループ化処理、すなわち、
同じ地名のデータをグループ化する。そして、「TOK
YO」でも「YOKOHAMA」でもない地名を持つ行
のデータについて平均年齢を求める。これに対して、図
12Bに示すSQL文であれば、テーブル「ADDRE
SS」のカラム「LOCATION」について、「TO
KYO」でも「YOKOHAMA」でもない地名を持つ
行のデータを抽出する。そして、これらをグループ化処
理する。したがって、不要なグループ化処理が不要とな
るので、より高速処理が可能となる。When the HAVING clause is converted to the WHERE clause,
The fact that the search processing time is shortened depends on the characteristics of the Oracle database system. That is, in the Oracle database system, when the SQL statement shown in FIG. 5B is given, the column “LO” of the table “ADDRESS” is given.
"CATION", the grouping process, that is,
Group data with the same place name. And, "TOK
The average age is calculated for the data of the row having the place name which is neither “YO” nor “YOKOHAMA”. On the other hand, in the case of the SQL statement shown in FIG. 12B, the table “ADDRE
For the column "LOCATION" of "SS", click "TO
Data of a line having a place name that is neither "KYO" nor "YOKOHAMA" is extracted. Then, these are grouped. Therefore, unnecessary grouping processing is unnecessary, and higher speed processing is possible.
【0064】同様にして、図5Cに示すSQL文は、知
識ID0003を用いて、図12Cに示すように変換さ
れる。このような変換によって高速処理が可能となるの
は、インデックスが存在している場合は、必ずカラムも
存在するから、インデックス付きのカラムをカウントす
る方が高速処理ができるからである。Similarly, the SQL sentence shown in FIG. 5C is converted as shown in FIG. 12C using the knowledge ID 0003. High speed processing is possible by such conversion because when an index exists, columns always exist, and therefore counting an indexed column enables higher speed processing.
【0065】また、図5Dに示すSQL文は、知識ID
0004を用いて、図12Dに示すように変換される。
このような変換によって高速処理が可能となるのは、以
下の様な理由による。図5Dに示すSQL文が与えられ
ると、テーブル「transaction」のカラム
「account_name」について、第1番目の文
字から第7番目までの文字が”CAPITAL”である
カラムの、「account_name」「trans
date」および「amount」を求める。これに対
して、図12Dに示すSQL文であれば、インデックス
を用いて”CAPITAL”を含む前方一致検索が行わ
れる。したがって、インデックスを利用できる分だけ高
速処理が可能となるからである。The SQL statement shown in FIG. 5D is a knowledge ID.
0004 is used to convert as shown in FIG. 12D.
The reason why high speed processing is possible by such conversion is as follows. Given the SQL statement shown in FIG. 5D, for the column “account_name” of the table “transaction”, the “account_name” and “trans” of the columns in which the first to seventh characters are “CAPITAL” are given.
"date" and "amount" are calculated. On the other hand, in the case of the SQL statement shown in FIG. 12D, the prefix match search including “CAPITAL” is performed using the index. Therefore, high-speed processing can be performed as much as the index can be used.
【0066】以上の様にして、与えられたSQL文につ
いて、1つ1つ予め記憶している修正知識に該当するか
否かを判断して、変換可能SQL文は変換するようにし
ている。As described above, it is determined whether or not each given SQL sentence corresponds to the correction knowledge stored in advance, and the convertible SQL sentence is converted.
【0067】[その他の実施例]上記実施例において
は、各修正知識について、図6に示す様にデータベース
構造情報が必要か否かのフラグを付加しておき、変換対
象のSQL文中で参照されるテーブルおよび列につい
て、関係するテーブル情報、カラム情報およびインデッ
クス情報を抽出する様にしている。しかし、これに限定
されず、以下の様に、条件判断に必要な場合のみ、その
データを抽出するようにしてもよい。かかるデータを個
別必要構造情報という。[Other Embodiments] In the above embodiment, a flag indicating whether or not database structure information is necessary is added to each correction knowledge as shown in FIG. 6, and the correction knowledge is referred to in the SQL statement to be converted. The related table information, column information, and index information are extracted for each table and column. However, the present invention is not limited to this, and the data may be extracted only when necessary for the condition determination as described below. Such data is called individual required structure information.
【0068】すなわち、個別必要構造情報とは、当該S
QL文で特定されている処理をするに当たって必要なデ
ータベースの構造情報のうち、当該変換知識の条件に合
致するか否かを判断するのに必要なデータをいう。具体
的には、図5AのSQL文についてSQL文1における
個別必要構造情報とは、条件(1)については「なし」、
条件(2)については、列「NAME_ID」、「SALARY」に関す
るインデックス情報であり、条件(3)については、図9
A,Bに示すテーブル名「EMPLOY」の行数、および列
「NAME_ID」、「NAME」、「SALARY」のユニーク数であ
る。That is, the individual required structure information is the S
Of the structural information of the database necessary for performing the processing specified by the QL sentence, it means the data necessary for judging whether or not the condition of the conversion knowledge is met. Specifically, regarding the SQL statement of FIG. 5A, the individual required structure information in the SQL statement 1 is “none” for the condition (1),
The condition (2) is index information regarding the columns “NAME_ID” and “SALARY”, and the condition (3) is shown in FIG.
It is the number of rows of the table name "EMPLOY" shown in A and B, and the unique number of columns "NAME_ID", "NAME", and "SALARY".
【0069】かかる個別必要構造情報を用いた判断(図
3ステップST10)について、図13を用いて説明す
る。CPU23は、個別必要構造情報が必要か否か判断
する(ステップST41)。例えば、図5Aに示すSQ
L文の場合は、条件(2)を見れば個別必要構造情報が必
要であることが分かる。The determination using the individual required structure information (step ST10 in FIG. 3) will be described with reference to FIG. The CPU 23 determines whether or not the individual required structure information is required (step ST41). For example, the SQ shown in FIG. 5A
In the case of the L sentence, it can be seen from the condition (2) that the individual required structure information is required.
【0070】つぎに、CPU23は、変換対象のSQL
文および当該修正知識を参照して、個別必要構造情報を
決定する(ステップST43)。この場合、図5Aに示
すSQL文および図6に示す修正知識0001を参照し
て、列「NAME_ID」、「SALARY」に関するインデックス
情報およびテーブル名「EMPLOY」の行数、および列「NA
ME_ID」、「NAME」、「SALARY」のユニーク数が、個別
必要構造情報であると判断される。つぎに、CPU23
は、DBMS34にアクセスして、データベース部35
のデータベースディクショナリから、かかる個別必要構
造情報を抽出する(図13ステップST45)。Next, the CPU 23 determines the SQL to be converted.
The individual required structure information is determined with reference to the sentence and the correction knowledge (step ST43). In this case, referring to the SQL statement shown in FIG. 5A and the correction knowledge 0001 shown in FIG. 6, the index information regarding the columns “NAME_ID”, “SALARY”, the number of rows of the table name “EMPLOY”, and the column “NA” are displayed.
The unique numbers of “ME_ID”, “NAME”, and “SALARY” are determined to be the individual required structure information. Next, the CPU 23
Accesses the DBMS 34, and the database unit 35
The individual required structure information is extracted from the database dictionary (step ST45 in FIG. 13).
【0071】このように、構造情報のうち、当該SQL
文の処理に必要な個別必要構造情報のみを抽出すること
により、不要な構造情報の抽出時間分だけ高速化するこ
とができる。なお、この場合は、図6に示すデータベー
ス構造情報の要否については、特に記憶しなくてもよ
い。As described above, of the structure information, the SQL
By extracting only the individual required structural information necessary for processing the sentence, the speed can be increased by the extraction time of the unnecessary structural information. In this case, the necessity of the database structure information shown in FIG. 6 need not be stored.
【0072】なお、上記各実施例では、サブ知識S1の
判断について、ファジィ推論を用いたが、通常の推論で
判断するようにしてもよい。In each of the above embodiments, the fuzzy reasoning is used for the judgment of the sub-knowledge S1, but the judgment may be made by the normal reasoning.
【0073】なお、本実施例においては、前記各機能を
実現する為に、CPU23を用い、ソフトウェアによっ
てこれを実現している。しかし、その一部もしくは全て
を、ロジック回路等のハードウェアによって実現しても
よい。In this embodiment, the CPU 23 is used to realize the above-mentioned functions, and this is realized by software. However, some or all of them may be realized by hardware such as a logic circuit.
【0074】また、上記実施例においては、プログラム
をフレキシブルディスクに記憶させて、これをハードデ
ィスク26にインストールするようにしたが、他の記憶
媒体、例えば、ROM、ICカード、光ディスク、CD
−ROM等からインストールしてもよく、さらにこれら
記憶媒体から直接プログラムを読み出して実行するよう
にしてもよい。In the above embodiment, the program is stored in the flexible disk and installed in the hard disk 26. However, other storage media such as ROM, IC card, optical disk and CD are used.
-The program may be installed from a ROM or the like, and the program may be directly read from these storage media and executed.
【0075】なお、ファジィ検索を行うデータベースシ
ステムについても、同様に適用することができる。Note that the same can be applied to a database system that performs fuzzy search.
【図1】本発明にかかる検索命令最適化装置1の機能ブ
ロック図である。FIG. 1 is a functional block diagram of a search instruction optimizing apparatus 1 according to the present invention.
【図2】図1に示す検索命令最適化装置1をCPUで実
現したハードウェア構成を示す図である。FIG. 2 is a diagram showing a hardware configuration in which the search instruction optimizing device 1 shown in FIG. 1 is realized by a CPU.
【図3】検索命令最適化装置1の処理フローチャートで
ある。FIG. 3 is a processing flowchart of the search instruction optimizing device 1.
【図4】図3ステップST10の詳細フローチャートで
ある。FIG. 4 is a detailed flowchart of step ST10 in FIG.
【図5】入力されたSQL文(変換前)を示す図であ
る。FIG. 5 is a diagram showing an input SQL sentence (before conversion).
【図6】SQL文の変換する修正知識の一例を示す図で
ある。FIG. 6 is a diagram showing an example of correction knowledge for converting an SQL sentence.
【図7】修正サブ知識の一例を示す図である。FIG. 7 is a diagram showing an example of modified sub-knowledge.
【図8】データベース構造情報を取得するSQL文を示
す図である。FIG. 8 is a diagram showing an SQL statement for acquiring database structure information.
【図9】取得したデータベース構造情報の一例を示す図
である。FIG. 9 is a diagram showing an example of acquired database structure information.
【図10】サブ知識S1に合致するか否かをファジィ推
論するルールを示す図である。FIG. 10 is a diagram showing a rule for fuzzy inference as to whether or not it matches the sub-knowledge S1.
【図11】サブ知識S1に合致するか否かをファジィ推
論するメンバシップ関数を示す図である。FIG. 11 is a diagram showing a membership function for fuzzy inference as to whether or not it matches the sub-knowledge S1.
【図12】修正されたSQL文(変換後)を示す図であ
る。FIG. 12 is a diagram showing a modified SQL sentence (after conversion).
【図13】図3ステップST10における他の判断方法
の詳細フローチャートである。FIG. 13 is a detailed flowchart of another determination method in step ST10 of FIG.
3・・・・・最適化手段 5・・・・・構造情報取得手段 7・・・・・変換知識記憶手段 40・・・・データベースシステム 3 ... Optimization means 5 ... Structural information acquisition means 7 ... Conversion knowledge storage means 40 ... Database system
───────────────────────────────────────────────────── フロントページの続き (72)発明者 八竹 英紀 京都府京都市右京区花園土堂町10番地 オ ムロン株式会社内 (72)発明者 前川 浩二 京都府京都市右京区花園土堂町10番地 オ ムロン株式会社内 ─────────────────────────────────────────────────── ─── Continuation of the front page (72) Inventor Hideki Yatake 10 No.10 Hanazono Dodocho, Ukyo-ku, Kyoto Prefecture Kyoto Prefecture Omron Co., Ltd. Within Muron Co., Ltd.
Claims (9)
憶する変換知識記憶手段、 与えられた検索命令を前記変換知識に当てはめ、変換可
能であると判断した場合は、前記検索命令を変換して最
適化検索命令を出力する最適化手段、 を備えたことを特徴とする検索命令最適化装置。1. A conversion knowledge storage means for storing conversion knowledge for optimizing a search command, applying a given search command to the conversion knowledge, and converting the search command when it is determined that conversion is possible. And an optimization means for outputting an optimized search instruction.
ムから当該データベースシステムの構造情報を取得し
て、前記最適化手段に出力する構造情報取得手段を備
え、 前記最適化手段は、当該データベースシステムの構造情
報が必要であると判断した場合には、前記構造情報取得
命令を出力し、前記検索命令に加えて前記構造情報取得
手段で取得される構造情報を用いて、前記変換可能か否
か判断すること、 を特徴とする検索命令最適化装置。2. The search command optimizing device according to claim 1, wherein when a structure information acquisition command is given, structure information acquisition means for acquiring the structure information of the database system from the database system and outputting the structure information to the optimization means. When the optimization unit determines that the structure information of the database system is necessary, the optimization unit outputs the structure information acquisition command, and the structure information acquisition unit acquires the structure information acquisition command in addition to the search command. A search instruction optimizing device, characterized in that it is determined whether or not the conversion is possible using structure information.
装置において、 前記変換知識は、メンバシップ関数およびルールから構
成されており、 前記最適化手段は、ファジィ推論によって前記検索命令
を変換すること、 を特徴とする検索命令最適化装置。3. The search instruction optimizing apparatus according to claim 1 or 2, wherein the conversion knowledge comprises a membership function and a rule, and the optimizing means converts the search instruction by fuzzy inference. A search instruction optimizing device characterized by:
装置において、 前記最適化手段は、 1)前記検索命令で検索対象となる表について、列の選択
性および行数に基づいて、インデックスを使用して検索
すべきか否か判断するとともに、 2)インデックスを使用して検索すべきであると判断した
場合には、前記検索命令をインデックス検索可能となる
ように変換すること、 を特徴とする検索命令最適化装置。4. The search instruction optimizing device according to claim 2 or 3, wherein the optimizing means: 1) based on column selectivity and the number of rows for a table to be searched by the search instruction. In addition to determining whether to search using the index, 2) if it is determined to search using the index, convert the search command to enable index search. And a search instruction optimizing device.
令を最適化するための検索命令最適化方法であって、 与えられた検索命令を、予め記憶しておいた変換知識に
当てはめて、変換可能である場合は、前記検索命令を変
換して最適化すること、 を特徴とする検索命令最適化方法。5. A search instruction optimizing method for optimizing a search instruction given to a database system, which can be converted by applying the given search instruction to conversion knowledge stored in advance. In this case, the search command is optimized by converting the search command.
た場合には、データベースシステムからその構造情報を
取得し、前記検索命令に加えて、さらに前記取得された
構造情報を用いること、 を特徴とする検索命令最適化方法。6. The search instruction optimizing method according to claim 5, wherein when it is determined that the structural information of the database system is necessary, the structural information is acquired from the database system, and in addition to the search instruction, A method for optimizing a search command, comprising using the acquired structure information.
方法において、 前記変換知識は、メンバシップ関数およびルールから構
成されており、 前記変換可能か否かの判断を、ファジィ推論を用いて行
うこと、 を特徴とする検索命令最適化方法。7. The search instruction optimizing method according to claim 5 or 6, wherein the conversion knowledge includes a membership function and a rule, and fuzzy inference is used to determine whether the conversion is possible. The method for optimizing search instructions is characterized by:
方法において、 前記検索命令で検索対象となる表について、列の選択性
および行数に基づいて、インデックスを使用して検索す
べきか否か判断するとともに、 インデックスを使用して検索すべきであると判断した場
合には、前記検索命令をインデックス検索可能となるよ
うに変換すること、 を特徴とする検索命令最適化方法。8. The search instruction optimizing method according to claim 6 or 7, wherein a table to be searched by the search instruction should be searched using an index based on column selectivity and the number of rows. A search instruction optimizing method comprising: determining whether or not to search by using an index, and converting the search instruction so that the index can be searched.
又は方法を、コンピュータを用いて実現する為のプログ
ラムを記憶した記憶媒体。9. A storage medium storing a program for realizing the apparatus or method according to any one of claims 1 to 8 by using a computer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP7186746A JPH0934760A (en) | 1995-07-24 | 1995-07-24 | Device and method for optimizing retrieving instruction |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP7186746A JPH0934760A (en) | 1995-07-24 | 1995-07-24 | Device and method for optimizing retrieving instruction |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH0934760A true JPH0934760A (en) | 1997-02-07 |
Family
ID=16193926
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP7186746A Pending JPH0934760A (en) | 1995-07-24 | 1995-07-24 | Device and method for optimizing retrieving instruction |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH0934760A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10283371A (en) * | 1997-04-04 | 1998-10-23 | Nec Corp | Data base device |
JP2004030677A (en) * | 2002-06-25 | 2004-01-29 | Microsoft Corp | Method for choosing optimal query execution plan for multiple defined equivalent query expressions |
-
1995
- 1995-07-24 JP JP7186746A patent/JPH0934760A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10283371A (en) * | 1997-04-04 | 1998-10-23 | Nec Corp | Data base device |
JP2004030677A (en) * | 2002-06-25 | 2004-01-29 | Microsoft Corp | Method for choosing optimal query execution plan for multiple defined equivalent query expressions |
JP4515050B2 (en) * | 2002-06-25 | 2010-07-28 | マイクロソフト コーポレーション | How to select the optimal query execution plan for multiple defined equivalent query expressions |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5442780A (en) | Natural language database retrieval system using virtual tables to convert parsed input phrases into retrieval keys | |
US6021411A (en) | Case-based reasoning system and method for scoring cases in a case database | |
US5649193A (en) | Document detection system using detection result presentation for facilitating user's comprehension | |
US5732274A (en) | Method for compilation using a database for target language independence | |
KR100295032B1 (en) | An information retrieval method, an information retrieval apparatus, and a storage medium for storing an information retrieval program | |
US6496820B1 (en) | Method and search method for structured documents | |
CN111143479A (en) | A fusion method of knowledge graph relation extraction and REST service visualization based on DBSCAN clustering algorithm | |
US20020165707A1 (en) | Methods and apparatus for storing and processing natural language text data as a sequence of fixed length integers | |
US20090024384A1 (en) | Data processing method and system, program for realizing the method, and computer readable storage medium storing the program | |
US5465352A (en) | Table-and-cache-based database assist method | |
US5819256A (en) | Method and apparatus for processing count statements in a database system | |
JPH11110416A (en) | Method and device for retrieving document from data base | |
US6343286B1 (en) | Efficient technique to defer large object access with intermediate results | |
JP2006523344A (en) | System and method for interactive search query refinement | |
JP2002297651A (en) | Method and system for information retrieval, and program | |
JPH0675992A (en) | Limited-state transducer in related work pattern for indexing and retrieving text | |
US5950184A (en) | Indexing a database by finite-state transducer | |
US6505198B2 (en) | Sort system for text retrieval | |
JP3612769B2 (en) | Information search apparatus and information search method | |
JPH0934760A (en) | Device and method for optimizing retrieving instruction | |
JPH064584A (en) | Text retriever | |
JP2000148754A (en) | Multilingual system, multilingual processing method, and medium storing program for multilingual processing | |
JP3249743B2 (en) | Document search system | |
JP2002132789A (en) | Document retrieving method | |
JPH05250416A (en) | Registering and retrieving device for data base |