JPH05342277A - Enquiry processing method and data base processor - Google Patents

Enquiry processing method and data base processor

Info

Publication number
JPH05342277A
JPH05342277A JP4170245A JP17024592A JPH05342277A JP H05342277 A JPH05342277 A JP H05342277A JP 4170245 A JP4170245 A JP 4170245A JP 17024592 A JP17024592 A JP 17024592A JP H05342277 A JPH05342277 A JP H05342277A
Authority
JP
Japan
Prior art keywords
processing
query
database
conditional expression
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP4170245A
Other languages
Japanese (ja)
Inventor
Masashi Tsuchida
正士 土田
Yukio Nakano
幸生 中野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP4170245A priority Critical patent/JPH05342277A/en
Publication of JPH05342277A publication Critical patent/JPH05342277A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To enable high speed enquiry processing by detecting conditional expressions for which evaluation is not required by discrimination from a value substituted at the time of the execution of the enquiry when variables are included in the enquiry. CONSTITUTION:Before an application program (AP) 10 is executed, a part relating to the enquiry corresponding to a screen 50 is compiled beforehand by a data base management system (DMBS 20) and an execution form is generated and preserved. The DMBS 20 is constituted of the enquiry processing for realizing the analysis processing (220) of the enquiry performed before the execution of the enquiry, optimization (221) and execution form conversion (222) and enquiry execution processing for substituting a constant for the variable, selecting processing sequence and then realizing the execution of enquiry code interpretation. Then, by setting indeterminate, infinitesimal and infinity to a column for which the value is not substituted for the variable in an enquiry sentence, the authenticity of the pertinent conditional expression is decided and unrequired conditional expression evaluation is unnecessitated.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、デ−タベ−ス処理に関
し、特にリレ−ショナルデ−タベ−ス管理システムに適
した問合せの処理に好適な問合せ処理方法およびデータ
ベース処理装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to database processing, and more particularly to a query processing method and a database processing apparatus suitable for query processing suitable for a relational database management system.

【0002】[0002]

【従来の技術】デ−タベ−ス管理システム(以下DBM
Sと略記)、特にリレーショナルDBMSは、非手続き
的な言語で表現された問合せを処理して、内部処理手順
を決定し、実行する。このデータベース言語としてSQ
Lが用いられる(Database Language
SQL ISO 9075:1989)。従来の問合
せ処理の主な方法には、予め設定した規則に基づいて単
一の内部処理手順を決定するもの(例えば、Smit
h,J.M.,et,al.”Optimizing
the Performance of a Rela
tional Database Interfac
e” CACM Vol.18,No.10,Oct.
1975.)と、各種統計情報を用いて選定された複数
の候補処理手順から、コスト評価により、最適と思われ
るものを決定するもの(例えば、Selinger,
P.G.,et.al. ”Access Path Selection in
a Relational Databese Ma
nagement System” Proc.ACM
−SIGMOD, 1979.)とがある。前者は、処
理手順作成のための負荷は小さいけれども、一律に設定
された規則の妥当性に問題があり、選ばれた内部処理手
順の最適性にも問題がある。後者は、各種統計情報の管
理と、複数の候補処理手順の作成及びそれらのコスト評
価のための負荷があるものの、最適な処理手順を与え
る。また、上記両者の組合せ技術として、例えばSat
oh,K.,et.al.”Local and Gl
obal Optimization Mechani
sms for Relational Databa
se”, Proc. VLDB, 1985.があ
る。
2. Description of the Related Art A database management system (hereinafter DBM
(Abbreviated as S), in particular, a relational DBMS processes a query expressed in a non-procedural language to determine and execute an internal processing procedure. SQ as this database language
L is used (Database Language
SQL ISO 9075: 1989). The main method of conventional query processing is to determine a single internal processing procedure based on a preset rule (for example, Smit
h, J. M. , Et, al. "Optimizing
the Performance of a Rela
regional Database Interface
e "CACM Vol. 18, No. 10, Oct.
1975. ) And a plurality of candidate processing procedures selected by using various statistical information, a method that determines an optimum one by cost evaluation (for example, Selinger,
P. G. , Et. al. "Access Path Selection in
a Relational Database Ma
management System Proc. ACM
-SIGMOD, 1979. ) There is. The former has a small load for creating a processing procedure, but has a problem in the validity of a uniformly set rule, and also has a problem in the optimality of the selected internal processing procedure. Although the latter has a load for managing various statistical information, creating a plurality of candidate processing procedures and evaluating their costs, it provides an optimal processing procedure. Further, as a combination technique of the above two, for example, Sat
oh, K. , Et. al. "Local and Gl
oval Optimization Mechani
sms for Relational Database
se ", Proc. VLDB, 1985.

【0003】さらに、多くのDBMSは、問合せ解析処
理と問合せ実行処理の2フェーズの処理を経て、問合せ
処理が実現される。ホスト言語(COBOL、PL/I
等)に問合せ言語を組み込む場合、当アプリケ−ション
プログラム実行前に予め問合せを問合せ解析処理し、実
行形式である1つの内部処理手順を作成している。この
問合せ表現では、多くの場合検索条件式にはホスト言語
の変数が記述される。この変数に定数が代入されるの
は、既に問合せ解析処理された結果の内部処理手順の実
行時、すなわち問合せ実行時である。この場合の問題点
としては、変数に代入される値に従って複数の最適な処
理手順が考えられることである。この問題を解決するた
めに、プリプロセス処理時に複数の処理手順を作成して
おき、問合せ実行時に変数に代入された値に従って処理
手順を選択するものがある(特開平1−194028、
Graefe,G.,et.al. ”Dynamic Query Evaluation
Plans”, Proc. ACM−SIGMO
D, 1989.)。
Further, in many DBMSs, the inquiry process is realized through a two-phase process of an inquiry analysis process and an inquiry execution process. Host language (COBOL, PL / I
When the inquiry language is incorporated in (1), etc., the inquiry is analyzed in advance of the execution of this application program, and one internal processing procedure which is an execution format is created. In this query expression, a host language variable is often described in the search condition expression. The constant is assigned to this variable at the time of execution of the internal processing procedure of the result of the query analysis processing, that is, at the time of query execution. A problem in this case is that a plurality of optimum processing procedures can be considered according to the values assigned to the variables. In order to solve this problem, there is a method in which a plurality of processing procedures are created at the time of preprocessing and the processing procedure is selected according to the value assigned to the variable at the time of query execution (Japanese Patent Laid-Open No. 1-194028,
Graefe, G.M. , Et. al. "Dynamic Query Evaluation
Plans ”, Proc. ACM-SIGMO
D, 1989. ).

【0004】ここで、デ−タベ−スはユ−ザから2次元
のテ−ブル形式で見られるリレ−ションから成るものと
し、当該テ−ブルの行に対応するものをロウとするもの
である。また、ロウは、1つ以上の属性(これを「カラ
ム」という)から成っている。
Here, the database is assumed to consist of the relations that can be seen from the user in a two-dimensional table format, and the row corresponding to the row of the table is a row. is there. A row is made up of one or more attributes (which are called "columns").

【0005】[0005]

【発明が解決しようとする課題】上記従来技術は、問合
せ最適化処理とはユ−ザが入力した問合せから、デ−タ
ベ−スシステムの各種統計情報を基にして、最も効率の
良い処理手順をDBMSが自動判定するものである。さ
らに、問合せの選択条件式に変数が埋め込まれている場
合には、複数の処理手順を問合せ解析時に展開してお
き、問合せ実行時に当変数に代入される値に従って処理
手順を選択することによって、最適な処理手順が選択さ
れる。
The above-mentioned prior art is the most efficient processing procedure based on various statistical information of the database system from the query input by the user. Is automatically determined by the DBMS. Furthermore, when a variable is embedded in the selection condition expression of the query, multiple processing procedures are expanded at the time of query analysis, and the processing procedure is selected according to the value assigned to this variable at the time of query execution. The optimum processing procedure is selected.

【0006】ユーザが実行するアプリケ−ションプログ
ラムは、問合せに入力する変数に対応して値を設定さ
せ、問合せ文を実行し、検索結果を出力する。情報検索
では、検索結果のロウ数から判断して、順次問合せ条件
式を数個付加する、あるいはさらに絞り込みを行うよう
に条件式による検索範囲を狭くするような処理形態とな
る。従来技術によれば、この処理形態では、ユーザが設
定した値に対応して、動的に問合せを生成する方法が考
えられる。この方法では、ユーザが問合せを実行する毎
に問合せ解析処理が必要となり、オーバヘッドが大とな
る。また、ユーザが値を設定するカラムを問合せ条件式
とする問合せ文を予め作成しておく方法では、対応する
問合せの組合せ数が膨大となる問題がある。
The application program executed by the user sets a value corresponding to the variable input to the inquiry, executes the inquiry sentence, and outputs the search result. In the information search, the number of rows in the search result is judged, and several query condition expressions are sequentially added, or the search range by the condition expressions is narrowed so as to further narrow down. According to the conventional technique, in this processing form, a method of dynamically generating an inquiry corresponding to a value set by the user is conceivable. This method requires a query analysis process every time a user executes a query, resulting in a large overhead. In addition, the method of creating in advance a query statement in which a column in which a user sets a value is a query conditional expression has a problem that the number of combinations of corresponding queries becomes enormous.

【0007】そこで、ユーザが付与すると考えられるカ
ラムを条件式とする問合せを作成しておく。問合せ実行
時には、ユーザがすべての変数に値を代入しなくとも、
適切に評価したい条件式だけ条件評価処理の対象とする
方法が有効である。本発明の目的は、問合せに変数を含
む場合、問合せ実行時に代入される値から判断して評価
する必要のない条件式を検出し、高速な問合せ処理を実
現することにある。
Therefore, an inquiry is made in which a column considered to be given by the user is used as a conditional expression. Even if the user does not assign values to all variables when executing a query,
A method is effective in which only conditional expressions that are desired to be evaluated are subject to conditional evaluation processing. An object of the present invention is to realize a high-speed query processing by detecting a conditional expression that does not need to be evaluated and evaluated from a value substituted at the time of query execution when the query includes variables.

【0008】[0008]

【課題を解決するための手段】上記目的を達成するため
に、データベースに対するユーザからの問合せを解析し
て対応する処理手順を決定し、それを実行するシステム
における問合せ処理方法として、入力された問合せを解
析し、その解析結果から処理手順を作成する問合せ解析
処理過程と、前記問合せに代入される値と前記処理手順
の問合せ条件式とから判断して条件評価不要となる条件
式を検出し、該検出された条件式を除いた条件式を評価
することによって問合せ処理を実現する問合せ実行過程
を備えるものとする。
In order to achieve the above-mentioned object, a query input by a user is analyzed as a query processing method in a system that analyzes a query from a user to a database to determine a corresponding processing procedure and executes the procedure. And analyze the query analysis processing step of creating a processing procedure from the analysis result, and a conditional expression that does not require conditional evaluation by judging from the value assigned to the query and the query conditional expression of the processing procedure, A query execution process for realizing a query process by evaluating a conditional expression excluding the detected conditional expression is provided.

【0009】さらに、前記問合せ解析処理過程は前記解
析結果とデ−タベ−スの統計情報とから単一あるいは複
数の内部処理手順を選定、格納する過程を備え、前記問
合せ実行過程は前記選定、格納された内部処理手順の中
から条件式評価が必要となる条件式だけからなる処理手
順を選択し、実行する過程を備えるものとする。
Further, the inquiry analysis processing step includes a step of selecting and storing a single or a plurality of internal processing steps from the analysis result and the statistical information of the database, and the inquiry execution step is the selection, A process for selecting and executing a processing procedure consisting only of conditional expressions that require conditional expression evaluation from the stored internal processing procedures is provided.

【0010】そして、前記問合せに代入される値が、無
限小、無限大、未定からなるものとする。
The value assigned to the inquiry is assumed to be infinitesimal, infinite, or undecided.

【0011】また、上記目的を達成するための、少なく
とも処理装置と、主記憶装置と、データベースが格納さ
れた外部記憶装置とを備え、データベースに対するユー
ザからの問合せを解析して対応する処理を決定し、それ
を実行するデータベース処理装置として、前記処理装置
が、入力された問合せを解析し、その解析結果から処理
手順を作成する問合せ解析処理手段と、前記問合せに代
入される値と前記処理手順の問合せ条件式とから判断し
て条件評価不要となる条件式を検出し、該検出された条
件式を除いた条件式を評価することによって問合せ処理
を実現する問合せ実行処理手段を備えるものとし、さら
に、前記問合せ解析処理手段は前記解析結果とデ−タベ
−スの統計情報とから単一あるいは複数の内部処理手順
を選定、格納するよう構成され、前記問合せ実行処理手
段は前記選定、格納された内部処理手順の中から条件式
評価が必要となる条件式だけからなる処理手順を選択
し、該選択した処理手順を実行するよう構成されたもの
とし、そして、前記問合せに代入される値が、無限小、
無限大、未定からなるものとしている。
Further, in order to achieve the above object, at least a processing device, a main storage device, and an external storage device storing a database are provided, and an inquiry from a user to the database is analyzed to determine a corresponding process. Then, as a database processing device for executing it, the processing device analyzes the input query and creates a processing procedure from the analysis result, a query analysis processing means, a value substituted into the query and the processing procedure. And a query execution processing unit that realizes a query process by detecting a conditional expression that does not require conditional evaluation by judging from the query conditional expression and evaluating the conditional expression excluding the detected conditional expression, Further, the inquiry analysis processing means selects and stores a single or a plurality of internal processing procedures from the analysis result and the statistical information of the database. The query execution processing means is configured to select a processing procedure consisting only of conditional expressions requiring conditional expression evaluation from the selected and stored internal processing procedures, and execute the selected processing procedure. And the value assigned to the query is infinitesimal,
It is assumed to be infinite and undecided.

【0012】[0012]

【作用】本発明の問合せ処理方法によれば、問合せ文中
に含まれる変数に値を代入しないカラムに対して、未
定、無限小、無限大を設定することで、該当する条件式
の真偽が決定できる。また、予め作成された処理手順の
中から評価が必要となる条件式だけからなるものを選択
することによって、問合せ解析処理を実行し処理手順の
実行形式を動的に作成する必要がなく高速な問合せ処理
が可能となる。
According to the query processing method of the present invention, by setting undetermined, infinitesimal, or infinity to a column that does not assign a value to a variable included in a query statement, the true / false of the corresponding conditional expression can be determined. I can decide. In addition, by selecting a pre-created processing procedure that consists only of conditional expressions that need to be evaluated, it is not necessary to execute query analysis processing and dynamically create the execution format of the processing procedure. Inquiry processing becomes possible.

【0013】[0013]

【実施例】以下、本発明の実施例を図面に基づいて詳細
に説明する。図1は、本発明が適用されたデ−タベ−ス
処理の概略説明図である。本発明に好適な実施例である
が、後述することにする。図2は、デ−タベ−ス処理装
置におけるソフトウェア構成の一実現例である。ソフト
ウェア構成は、ユ−ザが作成したアプリケ−ションプロ
グラム(以下、APと略記する)10、11と、問合せ
処理、リソ−ス管理等デ−タベ−スシステム全体の管理
を行うデータベース管理システム(DBMS20)と、
デ−タベ−ス処理において、入出力処理対象となるデ−
タの読書きを行い、計算機システム全体の管理を受け持
つオペレ−ティングシステム(以下では、オペレ−ティ
ングシステムをOSと略記する)30と、デ−タベ−ス
処理対象となるデ−タを格納するデ−タベ−ス40とか
ら構成される。
Embodiments of the present invention will now be described in detail with reference to the drawings. FIG. 1 is a schematic explanatory diagram of a database processing to which the present invention is applied. A preferred embodiment of the present invention will be described later. FIG. 2 shows an implementation example of the software configuration in the database processing apparatus. The software configuration includes an application program (hereinafter abbreviated as AP) 10 and 11 created by a user and a database management system for managing the entire database system such as inquiry processing and resource management ( DBMS20),
In the database processing, the data that is the input / output processing target
An operating system (hereinafter, operating system is abbreviated as OS) 30 for reading and writing the data and managing the entire computer system, and data to be processed by the database are stored. And a database 40.

【0014】上記DBMS20は、DBMS全体の管
理、制御に加えて、入出力の管理等を行うシステム制御
部21と、問合せの構文解析、意味解析を行う問合せ解
析220、適切な処理手順を生成する最適化処理22
1、及び処理手順に対応したコ−ドの生成を行なうコー
ド生成222、当コ−ドの解釈実行を行うコ−ド解釈実
行部223から成る論理処理部22と、当DBMS20
で処理対象となるデ−タを格納するデ−タベ−スバッフ
ァ24と、アクセスしたデ−タの条件判定、編集、レコ
−ド追加等を実現するデ−タアクセス処理230、デ−
タベ−スレコ−ドの読み書きを制御するデ−タベ−スバ
ッファ制御231、入出力対象となるデ−タの格納位置
を管理するマッピング処理232、及びシステムで共用
するリソ−スの排他制御を実現する排他制御233とか
ら成るデ−タベ−スの物理処理を実行する物理処理部2
3とから構成されている。
The DBMS 20 generates a system control unit 21 that manages input / output and the like in addition to management and control of the entire DBMS, a query analysis 220 that performs query syntax analysis and semantic analysis, and an appropriate processing procedure. Optimization process 22
1, a code generation 222 for generating a code corresponding to a processing procedure, a logic processing unit 22 including a code interpretation execution unit 223 for executing interpretation of this code, and the DBMS 20.
A data base buffer 24 for storing the data to be processed in the above, a data access processing 230 for realizing the condition judgment, editing, record addition, etc. of the accessed data,
A database buffer control 231 for controlling reading / writing of a database record, a mapping process 232 for managing a storage position of data to be input / output, and an exclusive control of a resource shared by the system are realized. A physical processing unit 2 for executing the physical processing of the data base including the exclusive control 233.
3 and 3.

【0015】図3は、本発明が適用されるデータベース
処理装置のハ−ドウェア構成の一例を示すものである。
具体的には、図3は、ホスト計算機が稼動する処理環境
での適用例である。図3は、主記憶装置(MM)61を
保持する中央処理装置(CPU)60と、入出力制御を
行うチャネル装置(CHU)70と、データベースの格
納された外部記憶装置81(実施例ではディスク装置
(DK))と、外部記憶制御装置80(実施例ではディス
クを制御するディスク制御装置(DKC))とから成る。
FIG. 3 shows an example of the hardware configuration of the database processing apparatus to which the present invention is applied.
Specifically, FIG. 3 is an application example in a processing environment in which a host computer operates. FIG. 3 shows a central processing unit (CPU) 60 that holds a main memory unit (MM) 61, a channel unit (CHU) 70 that controls input / output, and an external storage unit 81 (a disk in the embodiment) that stores a database. apparatus
(DK)) and an external storage controller 80 (a disk controller (DKC) for controlling a disk in the embodiment).

【0016】図1は、本発明が適用されたデータベース
処理の概略説明図を示す。また、図4は、従来までのデ
ータベース処理の概略説明図を示す。この例では、デー
タベースに対する検索要求を示す。図4は、AP10に
対応した画面50からユーザが検索条件としたい項目
(仕入日が510〜511(例えば、510には期間の
初日が、511には期間の最終日が入力される)、売上
日が520〜521、金額が530〜531、入会年月
が540〜541、生年月日が550〜551)に値を
設定し、該当する処理結果を出力する。この処理のため
の問合せは、以下のようになる。 SELECT A.商品id,D.氏名,D.電話番
号,D.住所 FROM 商品 A,売上げ B,会員 C,顧客管
理 D WHERE A.商品id=B.商品id AND
A.仕入日 BETWEEN(_、_) AND B.
売上日 BETWEEN(_、_) ANDB.金額
BETWEEN(_、_) AND B.会員番号=
C.会員番号AND C.入会年月 BETWEEN
(_、_) AND C.顧客コード=D.顧客コード
AND C.生年月日 BETWEEN(_、_) ここで、A.商品idのAは表の名前、商品idはカラ
ムの値を示し、(_、_)の‘ ’は変数が入ることを
示す。
FIG. 1 is a schematic explanatory diagram of database processing to which the present invention is applied. Further, FIG. 4 is a schematic explanatory view of the conventional database processing. In this example, a search request for the database is shown. FIG. 4 shows items that the user wants to use as search conditions on the screen 50 corresponding to the AP 10 (the purchase date is 510 to 511 (for example, 510 is the first day of the period, and 511 is the last period of the period)). The sales date is 520 to 521, the amount is 530 to 531, the admission date is 540 to 541, and the birth date is 550 to 551), and the corresponding processing result is output. The inquiry for this processing is as follows. SELECT A. Product id, D.I. Name, D. Telephone number, D. Address FROM Product A, Sales B, Member C, Customer Management D WHERE A. Product id = B. Product id AND
A. Purchase date BETWEEN (_, _) AND B.
Sales date BETWEEN (_, _) ANDB. Amount of money
BETWEEN (_, _) AND B. Member number =
C. Membership number AND C. Membership date BETWEEN
(_, _) AND C. Customer code = D. Customer code AND C. Birth Date BETWEEN (_, _) Where A. The item id A indicates the table name, the item id indicates the column value, and the (_, _) ' 'Indicates that a variable is included.

【0017】AP10は、画面50に設定された入力値
を読み込み(100)、上記問合せを生成する(10
1)。このSQL文をコンパイルして実行形式を作成し
(102)、作成終了したことをAP10に返すことに
より、AP10から問合せ実行を要求し(103)、検
索結果出力(104)を出力ロウがなくなるまで(10
5)処理される。このコンパイル要求(102)では、
DBMS20が呼び出される。論理処理部22は、問合
せ文の構文解析、意味解析を実行し(220)、要求に
最も早く答えられる表を見る順番を決める最適な処理手
順を決定し(221)、当処理手順を実行形式に展開す
る(222)。また、実行要求(103)では、DBM
S20のコード解釈実行223が呼びだされ、商品テー
ブル41、売上げテーブル42、会員テーブル43、顧
客管理テーブル44からなるデータベース40をアクセ
スし、問合せで指定された項目を出力する。このよう
に、図4ではユーザが指定した値に応じて動的に問合せ
を生成する必要がある。
The AP 10 reads the input value set on the screen 50 (100) and generates the inquiry (10).
1). This SQL statement is compiled to create an execution format (102), and the completion of the creation is returned to AP10, requesting the query execution from AP10 (103), and outputting the search result output (104) until there is no output row. (10
5) Processed. In this compilation request (102),
The DBMS 20 is called. The logic processing unit 22 executes the syntax analysis and the semantic analysis of the query sentence (220), determines the optimum processing procedure for determining the order of viewing the table that can answer the request earliest (221), and executes this processing procedure. (222). In the execution request (103), the DBM
The code interpretation execution 223 of S20 is called, the database 40 including the product table 41, the sales table 42, the member table 43, and the customer management table 44 is accessed, and the item designated by the inquiry is output. As described above, in FIG. 4, it is necessary to dynamically generate the query according to the value specified by the user.

【0018】図1は、AP10が実行される前に画面5
0に対応した問合せに関する部分を事前にDBMS20
でコンパイルしておき、実行形式を生成して保存してお
く。上記問合せに関する部分の実行形式は、具体的に
は、問合せ解析(220)、最適化処理(221)、コ
ード生成(222)を経て作成される。AP10は、画
面50に設定された入力値を読み込み(100)、問合
せ実行を要求し(103)、検索結果出力(104)を
出力ロウがなくなるまで(105)処理される。また、
実行要求(103)では、DBMS20のコード解釈実
行部223が呼びだされ、商品テーブル41、売上げテ
ーブル42、会員テーブル43、顧客管理テーブル44
からなるデータベース40をアクセスし、問合せで指定
された項目を出力する。
FIG. 1 shows screen 5 before AP 10 is executed.
The part related to the inquiry corresponding to 0 is previously stored in the DBMS 20.
Compile with, generate the executable and save it. Specifically, the execution form of the part related to the inquiry is created through the query analysis (220), the optimization process (221), and the code generation (222). The AP 10 reads the input value set on the screen 50 (100), requests the query execution (103), and processes the search result output (104) until there are no output rows (105). Also,
In the execution request (103), the code interpretation execution unit 223 of the DBMS 20 is called, and the product table 41, the sales table 42, the member table 43, and the customer management table 44.
The database 40 consisting of is accessed to output the item designated by the inquiry.

【0019】図5、図6は、本発明を適用したDBMS
における処理のフロ−チャ−トである。DBMSは、問
合せ実行前に行われる問合せの解析処理(220)、最
適化(221)、実行形式変換(222)を実現する問
合せ処理と、変数に定数を代入し、処理手順を選択後、
問合せのコード解釈実行(223)を実現している問合
せ実行処理とからなる。
5 and 6 show a DBMS to which the present invention is applied.
It is a flowchart of the processing in. The DBMS performs query analysis processing (220), optimization (221), and execution format conversion (222) that are performed before query execution, and substitutes constants into variables and selects a processing procedure,
The query execution process realizes the code interpretation and execution (223) of the query.

【0020】各処理部について述べる。 (a)問合せ解析処理 ●問合せ解析220……入力された問合せ文の構文解
析、意味解析を実行 ●最適化処理221……問合せで出現する各種条件式か
ら条件を満足するデ−タの割合を推定し、予め設定して
いる規則を基に、有効なアクセスパス候補(特にインデ
クスを選出する)を作成し、処理手順の候補を作成 ●コード生成222……処理手順候補を実行形式に展開 (b)問合せ実行処理 ●コード解釈実行223……代入された定数に基づき、
評価が不要となる条件式を検出し、処理手順を決定し、
当処理手順を解釈、実行する。
Each processing unit will be described. (A) Query analysis processing ● Query analysis 220 ... Executes the syntax analysis and semantic analysis of the input query sentence. ● Optimization processing 221 ... Determines the proportion of data satisfying the conditions from various conditional expressions appearing in the query. Estimate and create a valid access path candidate (especially selecting an index) based on a preset rule and create a candidate for a processing procedure. Code generation 222 ... Expand processing procedure candidates into an execution format ( b) Query execution processing ● Code interpretation execution 223 ... Based on the assigned constants
Detect conditional expressions that do not require evaluation, determine the processing procedure,
Interpret and execute this processing procedure.

【0021】また、各処理部の詳細な処理フローの説明
を行う。問合せ解析処理90では、まず、問合せ解析
(220)で、問合せ文の構文解析、意味解析(220
0)後、最適化処理221で問合せ条件式に出現するカ
ラムにインデクス定義(例えば、図解コンピュータシリ
ーズ 江村潤朗 監修 経済学博士 穂鷹良介 著‘デー
タベース入門’ オーム社 に記載されている)が存在す
るかチェックする(2210)。インデクスが存在しな
ければ、処理手順として唯一テーブルスキャン(先頭の
ローからスキャンする)を選択する(2211)。それ
以外であれば、問合せ条件式に変数が出現するか否かチ
ェックする(2212)。変数が出現していなければ、
選択率の最も小となるカラムのインデクスを優先的に利
用する処理手順を作成する(2213)。変数が出現す
る場合、問合せで出現するカラムのインデクスをアクセ
スパスの候補として登録し(2214)、各インデクス
に対応した複数の処理手順を作成する(2215)。ま
た、コード生成222では、処理手順候補を実行形式に
展開しておく。
A detailed processing flow of each processing unit will be described. In the query analysis processing 90, first, in the query analysis (220), the syntax analysis and the semantic analysis (220) of the query sentence are performed.
0) After that, there is an index definition in the column that appears in the query condition expression in the optimization process 221 (for example, it is described in the "Introduction to Database" Ohmsha, by Dr. Ryosuke Hotaka, supervised by Junro Emura, illustrated computer series, and Dr. Economics). It is checked whether to do (2210). If there is no index, only the table scan (scan from the first row) is selected as the processing procedure (2211). Otherwise, it is checked whether a variable appears in the query conditional expression (2212). If the variable does not appear,
A processing procedure for preferentially using the index of the column having the smallest selectivity is created (2213). When a variable appears, the index of the column appearing in the query is registered as an access path candidate (2214), and a plurality of processing procedures corresponding to each index are created (2215). Further, in the code generation 222, the processing procedure candidates are expanded into the execution format.

【0022】問合せ実行処理91では、処理手順の実行
形式であるコードが解釈実行される。コード解釈実行2
23では、問合せに出現する変数への代入処理を実行し
たかチェックされる(2230)。一回でも実行されて
いれば、実行形式の処理手順が解釈実行される(223
7)。それ以外であり、処理手順が1つであれば(22
31)、実行形式の処理手順が解釈実行される(223
7)。複数の処理手順が存在する場合、代入する値に無
限大、無限小、未定が含まれているか否かチェックする
(2232)。ここで、無限大とは、カラムの値として
取りうる最大なものを意味し、無限小とは、カラムの値
として取りうる最小なものを意味し、未定とは、カラム
の値として取りうる全てのものを意味するものとする。
含まれていなければ、条件式評価が要となるカラムに定
義されたインデクスだけからなる処理手順を選択し(2
235)、実行形式の処理手順が解釈実行される(22
37)。それ以外であれば、該当する条件式の真偽をす
べて判定する(2233から2234)。真と判定され
た条件式に対応する処理手順を予め定められた処理手順
とし、偽と判定された条件式に対応する処理手順を予め
定められた処理手順とし、また、真あるいは偽と判定さ
れなかった条件式に対応する処理手順としては、条件式
評価が要となるカラムに定義されたインデクスだけから
なる処理手順を選択し(2236)、実行形式の処理手
順が解釈実行される(2237)。真と判定された条件
式に対応する予め定められた処理手順は全てのローを出
力するような処理手順であり、偽と判定された条件式に
対応する予め定められた処理手順は全てのローを出力し
ないような処理手順である。
In the inquiry execution processing 91, a code which is an execution form of a processing procedure is interpreted and executed. Code interpretation execution 2
At 23, it is checked whether or not the substitution process for the variable appearing in the query has been executed (2230). If it has been executed even once, the processing procedure of the execution format is interpreted and executed (223).
7). Otherwise, if there is only one processing procedure (22
31), the processing procedure of the execution format is interpreted and executed (223).
7). When there are a plurality of processing procedures, it is checked whether the values to be substituted include infinity, infinity, and undecided (2232). Here, infinity means the largest possible column value, infinitesimal means the smallest possible column value, and undecided means all possible column values. Shall mean.
If it is not included, select the processing procedure that consists only of the index defined in the column that requires conditional expression evaluation (2
235), the execution-type processing procedure is interpreted and executed (22).
37). Otherwise, the true / false of the corresponding conditional expression is determined (2233 to 2234). The processing procedure corresponding to the conditional expression determined to be true is a predetermined processing procedure, the processing procedure corresponding to the conditional expression determined to be false is a predetermined processing procedure, and is also determined to be true or false. As the processing procedure corresponding to the conditional expression that did not exist, a processing procedure consisting only of the index defined in the column that requires conditional expression evaluation is selected (2236), and the execution-type processing procedure is interpreted and executed (2237). .. The predetermined processing procedure corresponding to the conditional expression determined to be true is a processing procedure that outputs all rows, and the predetermined processing procedure corresponding to the conditional expression determined to be false is all the row. Is a processing procedure that does not output.

【0023】2233における条件式の真偽評価は、以
下のようになる。 ただし、Sup:無限大 Inf:無限小 Unknown:未定 とし、Cnはデータベース中の或るカラムを指すものと
する。 case1:選択条件式(=、<>、>、>=、<、<
=) 1.Cn=変数n:変数nがSup、Infであれば、
偽。Unknouwnであれば、真とする。 2.Cn<>変数n:1.の結果を論理反転する。(<
>は等しくないことを示す) 3.Cn>変数n:変数nがSup、Unknownで
あれば、偽。Infであれば、真とする。 4.Cn>=変数n:変数nがSupであれば、偽。I
nf、Unknownであれば真とする。 5.Cn<変数n:変数nがInf、Unknownで
あれば、偽。Supであれば真とする。 6.Cn<=変数n:変数nがInfであれば、偽。S
up、Unknownであれば、真とする。 case2:複合条件式(AND、OR) 1.各選択条件式に真偽評価を行い、AND、ORのブ
ール評価を適用する。 case3:IN条件式(SQLで定められている条件
式である) 1.Cn IN(変数1、変数2、...、変数n)
は、Cn=変数1 ORCn=変数2 OR ...
OR Cn=変数nに展開し、case2を適用する。 case4:BETWEEN条件式 1.Cn BETWEEN(変数1、変数2)は、Cn
>=変数1 ANDCn<=変数2に展開し、case
2を適用する。 例えば、Cn>=変数1が真で、Cn<=変数2が真な
らば、ブール評価は真になる。また、前述の問合せ内容
で、A.仕入れ日 BETWEEN( )を例に取
ると、CnはA.仕入れ日で、( )で示される変
数は夫々変数1と変数2となる。これまでの処理過程を
経て、問合せが実行される。
The true / false evaluation of the conditional expression in 2233 is as follows. However, Sup: infinity, Inf: infinity, Unknown: undecided, and Cn indicates a certain column in the database. case1: selection condition expression (=, <>,>,> =, <, <
=) 1. Cn = variable n: If the variable n is Sup or Inf,
false. If it is Unknown, it is true. 2. Cn <> variable n: 1. The result of is logically inverted. (<
> Indicates that they are not equal) 3. Cn> Variable n: False if the variable n is Sup or Unknown. If it is Inf, it is true. 4. Cn> = variable n: False if the variable n is Sup. I
If nf and Unknown are true. 5. Cn <variable n: False if the variable n is Inf or Unknown. True if Sup. 6. Cn <= variable n: False if the variable n is Inf. S
If it is up or Unknown, it is true. case 2: compound conditional expression (AND, OR) 1. True / false evaluation is performed on each selection conditional expression, and Boolean evaluation of AND and OR is applied. case3: IN conditional expression (conditional expression defined in SQL) 1. Cn IN (variable 1, variable 2, ..., Variable n)
Cn = variable 1 ORCn = variable 2 OR. . .
OR Cn = Expand to variable n and apply case2. case4: BETWEEN conditional expression 1. Cn BETWEEN (variable 1, variable 2) is Cn
> = Variable 1 ANDCn <= expand to variable 2 and case
Apply 2. For example, if Cn> = variable 1 is true and Cn <= variable 2 is true, then the boolean evaluation is true. In addition, according to the above inquiry contents, A. Stocking date BETWEEN ( ) As an example, Cn is A. Stocking date, ( The variables shown in parentheses are variable 1 and variable 2, respectively. The inquiry is executed through the processing steps so far.

【0024】以上、処理フロ−を説明した。本発明の問
合せ処理方法は、統計情報を用いた規則とコスト評価と
の併用に限らず、適当なデ−タベ−ス参照特性情報を与
える処理手順が得られるものであれば、例えばコスト評
価のみ、規則利用のみ、コスト評価と規則利用の併用等
の最適化処理を行うDBMSにも適用できる。本発明
は、大型計算機のソフトウェアシステムを介して実現す
ることも、また各処理部のために専用プロセッサが用意
された複合プロセッサシステムを介して実現することも
可能である。
The processing flow has been described above. The inquiry processing method of the present invention is not limited to the combined use of the rule using the statistical information and the cost evaluation, but only the cost evaluation can be performed as long as a processing procedure for providing an appropriate database reference characteristic information can be obtained. The present invention can also be applied to a DBMS that performs optimization processing such as only rule usage, cost evaluation and rule usage in combination. The present invention can be realized via a software system of a large-scale computer or a composite processor system in which a dedicated processor is prepared for each processing unit.

【0025】[0025]

【発明の効果】本発明によれば、1)問合せ文中に含まれ
る変数に値を代入しないカラムに対して、不定、無限
小、無限大を設定することで、該当する条件式の真、偽
が決定できるため、余分な条件式評価が不要となり、2)
予め作成された処理手順の中から評価が必要となる条件
式だけからなるものを選択することによって、問合せ解
析処理を実行し処理手順の実行形式を動的に作成する必
要がなく、高速な問合せ処理が実現可能となる。
EFFECTS OF THE INVENTION According to the present invention, 1) By setting an indefinite, infinitesimal small, or infinite large value to a column in which a value is not assigned to a variable included in a query statement, true or false of a corresponding conditional expression is set. Since it is possible to determine, 2) there is no need to evaluate additional conditional expressions.
By selecting from the pre-created processing procedures that consist only of conditional expressions that need to be evaluated, it is not necessary to execute the query analysis processing and dynamically create the execution format of the processing procedure. Processing becomes feasible.

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

【図1】データベース処理の概略説明図である。FIG. 1 is a schematic explanatory diagram of database processing.

【図2】データベース処理システムにおけるソフトウェ
ア構成図である。
FIG. 2 is a software configuration diagram in the database processing system.

【図3】本発明が適用されるデータベース処理装置のハ
ードウェア構成図である。
FIG. 3 is a hardware configuration diagram of a database processing device to which the present invention is applied.

【図4】従来のデータベース処理の概略説明図である。FIG. 4 is a schematic explanatory diagram of conventional database processing.

【図5】データベース管理システムにおける処理のフロ
ーチャートである。
FIG. 5 is a flowchart of processing in the database management system.

【図6】データベース管理システムにおける処理のフロ
ーチャートである。
FIG. 6 is a flowchart of processing in the database management system.

【符号の説明】[Explanation of symbols]

10、11 アプリケーションプログラム 20 データベース管理システム 22 論理処理部 220 問合せ解析 221 最適化 222 コード解析 223 コード解釈実行 30 オペレーティングシステム 40 データベース 50 画面 60 中央処理装置 61 主記憶装置 70 チャネル装置 80 ディスク制御装置 81 ディスク装置 10, 11 Application program 20 Database management system 22 Logical processing unit 220 Query analysis 221 Optimization 222 Code analysis 223 Code interpretation execution 30 Operating system 40 Database 50 Screen 60 Central processing unit 61 Main storage device 70 Channel device 80 Disk control device 81 Disk apparatus

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 データベースに対するユーザからの問合
せを解析して対応する処理手順を決定し、それを実行す
るデータベース処理システムにおける問合せ処理方法で
あって、 入力された問合せを解析し、その解析結果から処理手順
を作成する問合せ解析処理過程と、 前記問合せに代入される値と前記処理手順の問合せ条件
式とから判断して条件評価不要となる条件式を検出し、
該検出された条件式を除いた条件式を評価することによ
って問合せ処理を実現する問合せ実行過程を備えること
を特徴とする問合せ処理方法。
1. A query processing method in a database processing system for analyzing a query from a user to a database to determine a corresponding processing procedure, and executing the query, wherein an input query is analyzed and the analysis result is used. A query analysis processing step for creating a processing procedure, and a conditional expression that does not require conditional evaluation by judging from a value assigned to the query and a query conditional expression of the processing procedure,
A query processing method comprising a query execution process for realizing a query process by evaluating a conditional expression excluding the detected conditional expression.
【請求項2】 請求項1記載の問合せ処理方法におい
て、 前記問合せ解析処理過程は前記解析結果とデ−タベ−ス
の統計情報とから単一あるいは複数の内部処理手順を選
定、格納する過程を備え、 前記問合せ実行過程は前記選定、格納された内部処理手
順の中から条件式評価が必要となる条件式だけからなる
処理手順を選択し、実行する過程を備えることを特徴と
する問合せ処理方法。
2. The inquiry processing method according to claim 1, wherein the inquiry analysis processing step includes a step of selecting and storing a single or a plurality of internal processing procedures from the analysis result and the statistical information of the database. The query processing method comprises the step of selecting and executing a processing procedure consisting only of conditional expressions requiring conditional expression evaluation from the selected and stored internal processing procedures. ..
【請求項3】 請求項1または請求項2記載の問合せ処
理方法において、前記問合せに代入される値が、無限
小、無限大、未定からなることを特徴とする問合せ処理
方法。
3. The query processing method according to claim 1 or 2, wherein the value assigned to the query is infinitesimally small, infinitely large, or undecided.
【請求項4】 少なくとも処理装置と、主記憶装置と、
データベースが格納された外部記憶装置とを備え、デー
タベースに対するユーザからの問合せを解析して対応す
る処理を決定し、それを実行するデータベース処理装置
において、 前記処理装置は、入力された問合せを解析し、その解析
結果から処理手順を作成する問合せ解析処理手段と、 前記問合せに代入される値と前記処理手順の問合せ条件
式とから判断して条件評価不要となる条件式を検出し、
該検出された条件式を除いた条件式を評価することによ
って問合せ処理を実現する問合せ実行処理手段を備える
ことを特徴とするデータベース処理装置。
4. A processor and at least a main memory,
An external storage device in which a database is stored, in a database processing device that analyzes a query from a user to the database to determine a corresponding process, and executes the process, the processing device analyzes the input query. , A query analysis processing unit that creates a processing procedure from the analysis result, and a conditional expression that does not require conditional evaluation by judging from a value assigned to the query and a query conditional expression of the processing procedure,
A database processing device, comprising query execution processing means for realizing a query process by evaluating a conditional expression excluding the detected conditional expression.
【請求項5】 請求項4記載のデータベース処理装置に
おいて、 前記問合せ解析処理手段は前記解析結果とデ−タベ−ス
の統計情報とから単一あるいは複数の内部処理手順を選
定、格納するよう構成され、 前記問合せ実行処理手段は前記選定、格納された内部処
理手順の中から条件式評価が必要となる条件式だけから
なる処理手順を選択し、該選択した処理手順を実行する
よう構成されたことを特徴とするデータベース処理装
置。
5. The database processing apparatus according to claim 4, wherein the inquiry analysis processing means selects and stores a single or a plurality of internal processing procedures from the analysis result and the statistical information of the database. The query execution processing means is configured to select, from the selected and stored internal processing procedures, a processing procedure consisting only of conditional expressions that require conditional expression evaluation, and execute the selected processing procedure. A database processing device characterized by the above.
【請求項6】 請求項4または請求項5記載のデータベ
ース処理装置において、前記問合せに代入される値が、
無限小、無限大、未定からなることを特徴とするデータ
ベース処理装置。
6. The database processing device according to claim 4 or 5, wherein the value assigned to the inquiry is
A database processing device characterized by being infinitely small, infinitely large, and undecided.
JP4170245A 1992-06-04 1992-06-04 Enquiry processing method and data base processor Pending JPH05342277A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4170245A JPH05342277A (en) 1992-06-04 1992-06-04 Enquiry processing method and data base processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4170245A JPH05342277A (en) 1992-06-04 1992-06-04 Enquiry processing method and data base processor

Publications (1)

Publication Number Publication Date
JPH05342277A true JPH05342277A (en) 1993-12-24

Family

ID=15901367

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4170245A Pending JPH05342277A (en) 1992-06-04 1992-06-04 Enquiry processing method and data base processor

Country Status (1)

Country Link
JP (1) JPH05342277A (en)

Similar Documents

Publication Publication Date Title
US6567806B1 (en) System and method for implementing hash-based load-balancing query processing in a multiprocessor database system
US7610263B2 (en) Reusing intermediate workflow results in successive workflow runs
US8447743B2 (en) Techniques for processing database queries including user-defined functions
US7111025B2 (en) Information retrieval system and method using index ANDing for improving performance
US6263345B1 (en) Histogram synthesis modeler for a database query optimizer
US6556988B2 (en) Database management apparatus and query operation therefor, including processing plural database operation requests based on key range of hash code
US8965918B2 (en) Decomposed query conditions
US7698253B2 (en) Method and system for reducing host variable impact on access path selection
JPH01194028A (en) Method for processing data base
WO2002071260A1 (en) Adaptable query optimization and evaluation in temporal middleware
US6938036B2 (en) Query modification analysis
US7542962B2 (en) Information retrieval method for optimizing queries having maximum or minimum function aggregation predicates
JPH07141236A (en) Method and equipment for optimizing inquiry in relational database system with external function
US9256643B2 (en) Technique for factoring uncertainty into cost-based query optimization
US7085760B2 (en) Data query differential analysis
US5732258A (en) Method and apparatus for efficiently evaluating exists and not exists equivalent subqueries
Sasak-Okoń Modifying queries strategy for graph-based speculative query execution for RDBMS
JPH05342277A (en) Enquiry processing method and data base processor
JP3538322B2 (en) Database management system and query processing method
JP3434641B2 (en) Database processing method
JP4422697B2 (en) Database management system and query processing method
JP3667997B2 (en) Database management device
JP2021174079A (en) Data management system and data management method
JPH0778118A (en) Method for scheduling evasion of resource competition
JPH03189742A (en) Data base processing method