JP2020013448A - Inquiry sentence output apparatus and inquiry sentence output method - Google Patents
Inquiry sentence output apparatus and inquiry sentence output method Download PDFInfo
- Publication number
- JP2020013448A JP2020013448A JP2018136623A JP2018136623A JP2020013448A JP 2020013448 A JP2020013448 A JP 2020013448A JP 2018136623 A JP2018136623 A JP 2018136623A JP 2018136623 A JP2018136623 A JP 2018136623A JP 2020013448 A JP2020013448 A JP 2020013448A
- Authority
- JP
- Japan
- Prior art keywords
- query
- execution plan
- unit
- execution
- conversion
- 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.)
- Granted
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、データベースシステムにおいて実行可能な問合せ文を出力する問合せ文出力装置及び問合せ文出力方法に関する。 The present invention relates to a query statement output device and a query statement output method that output a query statement that can be executed in a database system.
従来、リレーショナルデータベースにおいて、処理コストを削減することを目的として、複数の問合せにおいて共通して行われる処理に対応する物理的なビューであるマテリアライズドビューを作成することが行われている(例えば、特許文献1参照)。 2. Description of the Related Art Conventionally, in a relational database, for the purpose of reducing processing costs, a materialized view, which is a physical view corresponding to a process commonly performed in a plurality of queries, is created (for example, see Patent Reference 1).
マテリアライズドビューは、データベースシステムにおいて実行される複数の実行計画において共通する処理のうち、処理コストが高い処理に対応して作成することが好ましい。このため、複数の実行計画において共通する処理を特定することが行われている。しかしながら、実行計画では、共通の処理であっても記述が異なることがある。また、異なる処理であっても記述が同じことがある。このように処理と実行計画が多対多であるため、実行計画に基づいて共通する処理を特定することが困難であるという問題が発生する。 It is preferable that the materialized view is created corresponding to a process having a high processing cost among processes common to a plurality of execution plans executed in the database system. For this reason, a process common to a plurality of execution plans is specified. However, in the execution plan, the description may be different even for a common process. Further, the description may be the same even in different processes. Since the processing and the execution plan are many-to-many as described above, there is a problem that it is difficult to specify a common processing based on the execution plan.
そこで、本発明はこれらの点に鑑みてなされたものであり、複数の実行計画において共通する処理を特定することを可能にする問合せ文出力装置及び問合せ文出力方法を提供することを目的とする。 Therefore, the present invention has been made in view of these points, and an object of the present invention is to provide a query statement output device and a query statement output method that can specify a process common to a plurality of execution plans. .
本発明の第1の態様に係る問合せ文出力装置は、データベースシステムにおいて実行された、複数の実行計画を特定する特定部と、前記特定部により特定された複数の前記実行計画を、当該実行計画に含まれる文字列の並びと、当該実行計画に対応する前記データベースシステムにおける問合せ文に含まれる文字列の並びとの関連性に基づいて前記問合せ文に変換するとともに、当該実行計画の一部である部分実行計画を前記問合せ文に変換する第1変換部と、前記第1変換部により変換された問合せ文を出力する出力部と、を備える。 A query statement output device according to a first aspect of the present invention includes a specifying unit that specifies a plurality of execution plans executed in a database system, and a plurality of the execution plans specified by the specifying unit. Is converted into the query statement based on the relevance between the arrangement of the character strings included in the query plan and the arrangement of the character strings included in the query statement in the database system corresponding to the execution plan. A first conversion unit that converts a certain partial execution plan into the query sentence; and an output unit that outputs the query sentence converted by the first conversion unit.
前記出力部は、前記第1変換部により変換された複数の問合せ文のうち、他の問合せ文と類似度が高い問合せ文を出力してもよい。 The output unit may output a query sentence having a high degree of similarity to another query sentence among the plurality of query sentences converted by the first conversion unit.
前記問合せ文出力装置は、前記実行計画を問合せ文に変換する変換モデルを生成する生成部をさらに備え、前記第1変換部は、複数の前記実行計画のそれぞれを前記変換モデルに入力し、前記変換モデルから出力される前記問合せ文を取得することにより、複数の実行計画のそれぞれを問合せ文に変換するとともに、複数の前記部分実行計画のそれぞれを前記変換モデルに入力し、前記変換モデルから出力される前記問合せ文を取得することにより、複数の前記部分実行計画のそれぞれを問合せ文に変換してもよい。 The query sentence output device further includes a generating unit that generates a conversion model that converts the execution plan into a query sentence, wherein the first conversion unit inputs each of the plurality of execution plans to the conversion model, By obtaining the query sentence output from the conversion model, each of the plurality of execution plans is converted into a query sentence, and each of the plurality of partial execution plans is input to the conversion model and output from the conversion model. Each of the plurality of partial execution plans may be converted into a query statement by acquiring the query statement.
前記問合せ文出力装置は、問合せ文を実行計画に変換する第2変換部をさらに備え、前記生成部は、前記変換モデルを生成し、当該変換モデルに対して前記特定部により特定された前記実行計画を入力することにより問合せ文を取得し、当該問合せ文を前記第2変換部に入力することにより、当該問合せ文に対応する実行計画を取得し、前記特定部により特定された前記実行計画と、当該変換モデルに対応する実行計画との類似度を算出し、前記変換モデルにおける設定情報を変更しながら、算出される類似度が相対的に高い変換モデルを選択してもよい。 The query sentence output device further includes a second conversion unit that converts the query sentence into an execution plan, wherein the generation unit generates the conversion model, and the execution model specified by the specification unit for the conversion model. By acquiring a query sentence by inputting a plan, by inputting the query sentence to the second conversion unit, an execution plan corresponding to the query sentence is acquired, and the execution plan identified by the identification unit is obtained. Alternatively, the similarity with the execution plan corresponding to the conversion model may be calculated, and a conversion model having a relatively higher calculated similarity may be selected while changing the setting information in the conversion model.
前記問合せ文出力装置は、問合せ文を実行計画に変換する第2変換部をさらに備え、前記生成部は、問合せ文を前記第2変換部に入力することにより、当該問合せ文に対応する実行計画を取得し、取得した当該実行計画を前記変換モデルに対して入力することにより問合せ文を取得し、前記第2変換部に入力された問合せ文と、前記変換モデルから取得した問合せ文との類似度を算出し、前記変換モデルにおける設定情報を変更しながら、算出される当該類似度が相対的に高い変換モデルを選択してもよい。 The query sentence output device further includes a second conversion unit that converts the query sentence into an execution plan, and the generation unit inputs the query sentence to the second conversion unit to execute the execution plan corresponding to the query sentence. Is obtained, and the obtained execution plan is input to the conversion model to obtain a query sentence. The query sentence input to the second conversion unit is similar to the query sentence obtained from the conversion model. While calculating the degree and changing the setting information in the conversion model, a conversion model having a relatively high calculated similarity may be selected.
前記第2変換部は、前記データベースシステムに、問合せ文に対応する実行計画を生成させることにより、当該問合せ文を実行計画に変換してもよい。
前記特定部は、データベースシステムにおいて実行された、実行コストが相対的に高い複数の実行計画を特定してもよい。
The second conversion unit may convert the query statement into an execution plan by causing the database system to generate an execution plan corresponding to the query statement.
The identification unit may identify a plurality of execution plans executed in the database system, the execution plans of which are relatively high.
本発明の第2の態様に係る問合せ文出力方法は、コンピュータが実行する、データベースシステムにおいて実行された、複数の実行計画を特定するステップと、特定された複数の前記実行計画を、当該実行計画に含まれる文字列の並びと、当該実行計画に対応する前記データベースシステムにおける問合せ文に含まれる文字列の並びとの関連性に基づいて前記問合せ文に変換するとともに、当該実行計画の一部である部分実行計画を前記問合せ文に変換するステップと、前記実行計画から変換された問合せ文を出力するステップと、を備える。 A query statement output method according to a second aspect of the present invention is a computer-implemented step of specifying a plurality of execution plans executed in a database system, and converting the specified plurality of execution plans to the execution plan. Is converted into the query statement based on the relevance between the arrangement of the character strings included in the query plan and the arrangement of the character strings included in the query statement in the database system corresponding to the execution plan. Converting a partial execution plan into the query sentence; and outputting a query sentence converted from the execution plan.
本発明によれば、複数の実行計画において共通する処理を特定することができるという効果を奏する。 According to the present invention, there is an effect that a process common to a plurality of execution plans can be specified.
[問合せ文出力装置1の概要]
図1は、本実施形態に係る問合せ文出力装置1の概要を示す図である。問合せ文出力装置1は、データベースシステム2が生成した実行計画を問合せ文に変換して出力するコンピュータである。
[Overview of Query Statement Output Device 1]
FIG. 1 is a diagram showing an outline of a
問合せ文出力装置1は、データベースシステム2と、LAN(Local Area Network)やインターネット等の通信ネットワークを介して通信可能に接続されている。問合せ文出力装置1は、データベースシステム2において実行された問合せ文に対応する実行計画をデータベースシステム2から取得する(図1の(1))。
The
問合せ文出力装置1は、実行計画を問合せ文に変換する変換モデルに基づいて、取得した実行計画を問合せ文に変換する(図1の(2))。問合せ文出力装置1は、変換された複数の問合せ文のうち、他の問合せ文と類似度が高い問合せ文を、マテリアライズドビューの作成に適している可能性が高い処理が実行される問合せ文として出力する(図1の(3))。
The query
実行計画は、同じ問合せ文であっても異なる記述となる場合があるところ、問合せ文出力装置1は、当該異なる記述を含む複数の実行計画を、同じ問合せ文に変換して出力することができる。これにより、問合せ文出力装置1のユーザは、複数の実行計画のみを参照する場合に比べて、これらの実行計画において共通する処理を特定することができる。
以下、問合せ文出力装置1の構成について説明する。
Although the execution plan may have different descriptions even for the same query statement, the query
Hereinafter, the configuration of the
[問合せ文出力装置1の構成例]
図2は、第1実施形態に係る問合せ文出力装置1の構成を示す図である。
問合せ文出力装置1は、記憶部11と、制御部12とを備える。
[Configuration Example of Query Statement Output Device 1]
FIG. 2 is a diagram illustrating a configuration of the inquiry
The
記憶部11は、例えば、ROM(Read Only Memory)及びRAM(Random Access Memory)等である。記憶部11は、問合せ文出力装置1を機能させるための各種プログラムを記憶する。記憶部11は、問合せ文出力装置1の制御部12を、後述する特定部121、生成部122、第2変換部123、第1変換部124、及び出力部125として機能させる問合せ文出力プログラムを記憶する。また、記憶部11は、生成部122により生成される、実行計画を問合せ文に変換するプログラムである変換モデルMを記憶する。
The storage unit 11 is, for example, a ROM (Read Only Memory) and a RAM (Random Access Memory). The storage unit 11 stores various programs for causing the
制御部12は、例えばCPU(Central Processing Unit)である。制御部12は、記憶部11に記憶されている各種プログラムを実行することにより、問合せ文出力装置1に係る機能を制御する。制御部12は、問合せ文出力プログラムを実行することにより、特定部121、生成部122、第2変換部123、第1変換部124、及び出力部125として機能する。また、制御部12は、変換モデルMを実行することにより、実行計画を問合せ文に変換する。
The
特定部121は、データベースシステム2から、データベースシステム2において実行された複数の実行計画のうち、実行コストが相対的に高い複数の実行計画を取得することにより、複数の実行計画を特定する。例えば、データベースシステム2において生成された実行計画には、実行コストが関連付けられており、特定部121は、関連付けられている実行コストが相対的に高い複数の実行計画を特定する。
The
また、特定部121は、データベースシステム2から、複数の実行計画のそれぞれに対応する問合せ文を取得することにより、複数の実行計画のそれぞれに関連付けられている問合せ文を特定する。ここで、実行計画は、データベースシステム2が、問合せ文に対応する処理を実行する際に生成する情報である。問合せ文は、データベースシステム2において実行されたSQL等の問合せ文である。
In addition, the specifying
図3は、問合せ文の一例を示す図である。図4は、図3に示す問合せ文に対応する実行計画を示す図である。図4において最初に示される文字列「Sort」と、「−>」の後に示される文字列とは、問合せ文によって実行される処理としてのノードを示している。また、文字列「Scan」を含むノード(以下、Scanノードともいう。)に続く文字列は、参照されるテーブルのテーブル名を示している。 FIG. 3 is a diagram illustrating an example of a query sentence. FIG. 4 is a diagram showing an execution plan corresponding to the query sentence shown in FIG. In FIG. 4, the character string "Sort" shown first and the character string shown after "->" indicate a node as a process executed by the query sentence. Further, a character string following a node including the character string “Scan” (hereinafter, also referred to as a “Scan node”) indicates the table name of the referenced table.
特定部121は、特定した実行計画に基づいて実行計画が示す木構造を表す実行計画文字列を生成する。具体的には、特定部121は、特定した実行計画に基づいて、実行計画に含まれる処理を示すノードと、実行計画に対応する処理において参照されるテーブルのテーブル名を抽出する。特定部121は、特定した実行計画を示すコードの記載順序と、抽出したノード及びテーブル名とに基づいて、実行計画に対応する問合せ文の木構造を抽出する。特定部121は、木構造のグラフである実行計画ツリーを生成する。
The specifying
図5は、図4に示す実行計画に対応する実行計画ツリーを示す図である。実行計画ツリーでは、各ノードN1〜N9における処理の略称を、括弧内に示している。例えば、ルートノードに対応する処理「Sort」の略称は「S」であり、処理「Group Aggregate」の略称は「GA」である。また、実行計画ツリーでは、Scanノードの下部にテーブル名を示している。 FIG. 5 is a diagram showing an execution plan tree corresponding to the execution plan shown in FIG. In the execution plan tree, the abbreviations of the processes at the nodes N1 to N9 are shown in parentheses. For example, the abbreviation of the process “Sort” corresponding to the root node is “S”, and the abbreviation of the process “Group Aggregate” is “GA”. In the execution plan tree, a table name is shown below the Scan node.
特定部121は、抽出された実行計画ツリーを、ルートとなるノードから行きがけ順及び帰りがけ順に走査することにより実行計画文字列を生成する。すなわち、特定部121は、実行計画ツリーを、ルートとなるノードから行きがけ順及び帰りがけ順に走査したときに検出されたノードの略称を、検出された順番で並べた文字列を実行計画文字列として生成する。
The identifying
ここで、特定部121は、処理が重複するノードには通し番号を付与する。例えば、図5に示されるノードN1と、ノードN3とは、いずれも「Sort(S)」である。そこで、特定部121は、ノードN1の略称を「S1」とし、ノードN2の略称を「S2」とする。また、特定部121は、Scanノードに対応する略称に、当該Scanノードにおいて参照されるテーブルのテーブル名称、カラム名称のリスト、フィルタ条件を関連付ける。
Here, the specifying
特定部121は、実行計画ツリーを行きがけ順に走査する際、各ノードで検出されたカラム名称と対応するテーブル名称を記憶することによりカラム名称のリストを作成する。そして、特定部121は、当該テーブル名称に関するScanノードが検出された際、当該テーブルに対応付けられたカラム名称のリストを関連付ける。
また、特定部121は、当該Scanノードにおいて参照されるテーブルのフィルタ条件を関連付ける。
When scanning the execution plan tree in the destination order, the
Further, the specifying
図6は、図5に示す実行計画ツリーに対応する実行計画文字列を示す図である。図6に示すように、実行計画文字列では、ノードが検出された順番に、当該ノードの略称が羅列されていることが確認できる。さらに、図6では、Scanノードの略称について、“→ テーブル名称[カラム名称リスト](フィルタ条件)”のように、参照されるテーブルのテーブル名称等が関連付けられていることが確認できる。 FIG. 6 is a diagram showing an execution plan character string corresponding to the execution plan tree shown in FIG. As shown in FIG. 6, in the execution plan character string, it can be confirmed that the abbreviations of the nodes are listed in the order in which the nodes are detected. Further, in FIG. 6, it can be confirmed that the abbreviation of the Scan node is associated with the table name of the referenced table, such as “→ table name [column name list] (filter condition)”.
特定部121は、特定した複数の実行計画のそれぞれについて実行計画文字列を生成する。また、特定部121は、特定した実行計画から、当該実行計画の一部である部分実行計画をさらに特定し、当該部分実行計画についても実行計画文字列を生成する。
The specifying
具体的には、特定部121は、実行計画ツリーにおいて、複数のテーブルの結合を示す「Nested Loop」や「Hash Join」の下位のノード群を部分実行計画として抽出する。そして、特定部121は、抽出した部分実行計画について実行計画文字列を生成する。特定部121は、実行計画文字列を作成する際に、Scanノードの略称について参照先のテーブル名称等を挿入又は置換を行うことにより、参照先のテーブル名称等の文字列を実行計画文字列に取り込んでもよい。例えば、特定部121は、参照先のテーブル名称等の文字列を実行計画文字列に取り込む際、括弧、カンマ等を空白(スペース)に置換してもよい。例えば、“IS → lineitem[l_extendedprice, l_discount, l_orderkey](l_shipdate > '1995-03-12'::date)”という文字列の場合、“IS lineitem l_extendedprice l_discount l_orderkey l_shipdate > 1995-03-12 date”という文字列に変換してもよい。
Specifically, the specifying
[変換モデルMの生成]
生成部122は、実行計画を問合せ文に変換する変換モデルMを生成する。具体的には、生成部122は、実行計画を示す実行計画文字列を入力すると、当該実行計画文字列に対応する問合せ文を出力する変換モデルMを生成する。例えば、生成部122は、記号列を入力すると対応する記号列を出力するモデルであるSequence-to-Sequenceモデルに教師データを与えて学習させることにより、変換モデルMを生成する。
[Generation of Conversion Model M]
The
教師データは、入力される記号列と、出力される記号列との組み合わせである。入力される記号列は、特定部121が特定した実行計画から生成した実行計画文字列であり、出力される記号列は、当該実行計画に関連付けられている問合せ文である。
The teacher data is a combination of an input symbol string and an output symbol string. The input symbol string is an execution plan character string generated from the execution plan specified by the specifying
生成部122は、変換モデルMを生成し、当該変換モデルMに対して特定部121により特定された実行計画を入力することにより問合せ文を取得する。そして、生成部122は、当該問合せ文を、第2変換部123に入力することにより、当該問合せ文に対応する実行計画を取得する。
The
ここで、第2変換部123は、問合せ文を実行計画に変換する機能を有している。第2変換部123は、データベースシステム2に問合せ文を入力し、当該問合せ文に対応する実行計画を生成させる。そして、第2変換部123は、データベースシステム2から当該実行計画を取得することにより、当該問合せ文を実行計画に変換する。
Here, the
続いて、生成部122は、特定部121により特定された一以上の実行計画と、変換モデルMから出力された問合せ文から変換された一以上の実行計画との類似度を算出する。例えば、生成部122は、特定部121により特定された実行計画と、変換モデルMから出力された問合せ文から変換された実行計画とのレーベンシュタイン距離を算出する。ここで、レーベンシュタイン距離は、文字列を比較対象の文字列に変換する場合に要する編集の回数を示しており、0回であれば、文字列と、比較対象の文字列とが一致していることを示している。また、レーベンシュタイン距離の値が小さければ小さいほど、文字列と、比較対象の文字列との類似度が高いことを示している。生成部122は、算出したレーベンシュタイン距離が小さければ小さいほど類似度が大きくなるように類似度を算出する。
Subsequently, the
生成部122は、Sequence-to-Sequenceモデルにおける設定情報を変更しながら、複数の変換モデルMを生成する。そして、生成部122は、生成した複数の変換モデルMのそれぞれについて、一以上の実行計画と、変換モデルMに対応する一以上の実行計画との類似度を算出し、算出した類似度に基づいて類似度の平均値を算出する。そして、生成部122は、算出される類似度の平均値が相対的に高い1つの変換モデルMを選択する。
The
図7は、変換モデルMの選択例を示す図である。図7に示すように、生成部122は、異なる設定情報により設定された複数の変換モデルを生成する。図7に示す例では、設定情報Aにより設定された変換モデルM1と、設定情報Bにより設定された変換モデルM2とが生成されている。
FIG. 7 is a diagram illustrating a selection example of the conversion model M. As illustrated in FIG. 7, the
生成部122は、生成した複数の変換モデルのそれぞれに、特定部121が特定した実行計画を入力して問合せ文に変換させ、第2変換部123により、当該問合せ文を実行計画に変換させる。そして、生成部122は、図7に示すように、複数の変換モデルのそれぞれに入力される、特定部121が特定した一以上の実行計画と、第2変換部123により変換された一以上の実行計画との類似度の平均である平均類似度を算出し、当該平均類似度が最も高い変換モデルを選択する。このようにすることで、問合せ文出力装置1は、変換精度の高い変換モデルMを生成することができる。
The generating
なお、生成部122は、図7に示すように、特定部121が特定した一以上の実行計画と、第2変換部123により変換された一以上の実行計画との類似度に基づいて、複数の変換モデルの中から変換モデルMを選択したが、これに限らない。
As illustrated in FIG. 7, the
生成部122は、特定部121が特定した問合せ文を第2変換部123に入力することにより、当該問合せ文に対応する実行計画を取得し、取得した当該実行計画を変換モデルに対して入力することにより問合せ文を取得し、第2変換部123に入力された問合せ文と、変換モデルから取得した問合せ文との類似度を算出してもよい。そして、生成部122は、変換モデルにおける設定情報を変更しながら、算出される当該類似度が相対的に高い変換モデルを選択してもよい。
The
図8は、変換モデルMの他の選択例を示す図である。図8に示す例では、図7に示す例と同様に、生成部122が、異なる設定情報により設定された複数の変換モデルを生成する。図8に示す例では、設定情報Aにより設定された変換モデルM1と、設定情報Bにより設定された変換モデルM2とが生成されている。
FIG. 8 is a diagram illustrating another example of selection of the conversion model M. In the example illustrated in FIG. 8, similarly to the example illustrated in FIG. 7, the
生成部122は、第2変換部123により、特定部121が特定した一以上の実行計画が生成された生成元となる問合せ文を実行計画に変換させる。そして、生成部122は、生成した複数の変換モデルのそれぞれに、変換された実行計画を入力して問合せ文に変換させる。そして、生成部122は、図8に示すように、複数の変換モデルのそれぞれに入力される、第2変換部123が変換した一以上の問合せ文と、変換モデルにより変換された一以上の問合せ文との類似度の平均である平均類似度を算出し、当該平均類似度が最も高い変換モデルを選択する。このようにすることで、問合せ文出力装置1は、図7に示す例と同様に変換精度の高い変換モデルMを生成することができる。
The
[問合せ文の出力]
第1変換部124は、特定部121により特定された複数の実行計画を、当該実行計画に含まれる文字列の並びと、当該実行計画に対応するデータベースシステム2における問合せ文に含まれる文字列の並びとの関連性に基づいて、データベースシステム2における問合せ文に変換するとともに、特定部121により特定された、当該実行計画の一部である部分実行計画を問合せ文に変換する。なお、第1変換部124は、問合せ文に含まれるテーブル名称に対して、部分実行計画に含まれるテーブル名称に関連付けられたカラム名称やフィルタ条件のうち問合せ文に含まれないものを、不足した情報として問合せ文に追加しても構わない。
[Output of query statement]
The
具体的には、第1変換部124は、複数の実行計画のそれぞれに対応する実行計画文字列を変換モデルMに入力し、当該変換モデルMから出力される問合せ文を取得することにより、複数の実行計画のそれぞれを問合せ文に変換する。同様に、第1変換部124は、複数の部分実行計画のそれぞれに対応する実行計画文字列を変換モデルMに入力し、当該変換モデルMから出力される問合せ文を取得することにより、複数の部分実行計画のそれぞれを問合せ文に変換する。
Specifically, the
なお、第1変換部124が変換モデルMに入力する実行計画及び部分実行計画は、変換モデルMの生成に用いられた実行計画及び部分実行計画と異なっていてもよい。この場合、特定部121は、生成部122が変換モデルMを生成した後に、新たに実行計画及び部分実行計画を特定してもよい。そして、第1変換部124は、新たに特定された実行計画及び部分実行計画に対応する実行計画文字列を変換モデルMに入力し、これらの実行計画を問合せ文に変換してもよい。
Note that the execution plan and the partial execution plan input to the conversion model M by the
出力部125は、第1変換部124により変換された問合せ文を出力する。具体的には、出力部125は、第1変換部124により変換された複数の問合せ文のうち、他の問合せ文と類似度が高い問合せ文を、問合せ文出力装置1に設けられた表示部(非表示)に出力したり、テキストファイルに出力して当該テキストファイルを記憶部11に記憶させたりする。また、出力部125は、問合せ文出力装置1と通信可能に接続されている管理端末(不図示)に出力してもよい。
The
例えば、出力部125は、第1変換部124により変換された複数の問合せ文のそれぞれについて、同様に変換された他の問合せ文と比較し、同一の文字列の問合せ文があれば名寄せし、名寄せされた問合せ文の個数に基づいて出現頻度を算出する。そして、出力部125は、出現頻度の高い問合せ文を、マテリアライズドビューの作成に適している可能性が高い処理が実行される問合せ文として出力する。
For example, the
また、出力部125は、第1変換部124により変換された複数の問合せ文のそれぞれについて、同様に変換された他の複数の問合せ文とのレーベンシュタイン距離を算出し、当該レーベンシュタイン距離に基づいて類似度の合計値を算出してもよい。例えば、出力部125は、他の複数の問合せ文のそれぞれとのレーベンシュタイン距離の合計値を、類似度の合計値として算出する。そして、出力部125は、類似度の合計値が高い問合せ文を、マテリアライズドビューの作成に適している可能性が高い処理が実行される問合せ文として出力してもよい。
Further, the
また、出力部125は、部分実行計画から変換された一以上の副問合せ文のそれぞれについて類似度を比較し、類似度が副問合せ文を、マテリアライズドビューの作成に適している可能性が高い処理に対応する副問合せ文として出力してもよい。
Further, the
[問合せ文出力装置1における処理の流れ]
続いて、問合せ文出力装置1における処理の流れについて説明する。図9は、本実施形態に係る問合せ文出力装置1における処理の流れを示すフローチャートである。
[Processing flow in query output device 1]
Next, the flow of processing in the
まず、特定部121は、実行コストが相対的に高い複数の実行計画を取得することにより、複数の実行計画を特定するとともに、当該実行計画に含まれる部分実行計画を特定する(S1)。
続いて、生成部122は、S1において特定された実行計画に基づいて変換モデルMを生成する(S2)。なお、生成部122は、変換モデルMが既に生成されているか否かを判定してもよい。そして、生成部122は、変換モデルMが既に生成されていると判定すると、変換モデルMを生成しないようにしてもよい。
First, the specifying
Subsequently, the
続いて、第1変換部124は、実行計画及び部分実行計画を変換モデルMに入力して、変換モデルMから問合せ文を取得することにより、実行計画及び部分実行計画を問合せ文に変換する(S3)。
Subsequently, the
続いて、出力部125は、S3において変換された複数の問合せ文のうち、他の問合せ文と類似度が高い問合せ文を出力する(S4)。
Subsequently, the
[本実施形態における効果]
以上の通り、本実施形態に係る問合せ文出力装置1は、データベースシステム2において実行された、複数の実行計画をデータベースシステムにおける問合せ文に変換するとともに、当該実行計画の一部である部分実行計画を問合せ文に変換し、変換された問合せ文を出力する。このようにすることで、問合せ文出力装置1のユーザは、複数の実行計画のみを参照する場合に比べて、これらの実行計画において共通する処理を特定することができる。
[Effects in the present embodiment]
As described above, the query
また、問合せ文出力装置1は、データベースシステムにおいて実行された、実行コストが相対的に高い複数の実行計画を特定し、当該実行計画に対応する問合せ文を出力する。このようにすることで、出力される問合せ文は、実行コストが相対的に高い問合せ文となる。したがって、問合せ文出力装置1のユーザは、当該問合せ文に基づいて、効果的なマテリアライズドビューに対応する処理を特定することができる。
In addition, the query
また、問合せ文出力装置1は、変換された複数の問合せ文のうち、他の問合せ文と類似度が高い問合せ文を出力する。このようにすることで、問合せ文出力装置1のユーザは、出力される問合せ文から、マテリアライズドビューの作成に適した処理に対応する副問合せ文を特定することができる。
Further, the query
以上、本発明を実施の形態を用いて説明したが、本発明の技術的範囲は上記実施の形態に記載の範囲には限定されない。上記実施の形態に、多様な変更又は改良を加えることが可能であることが当業者に明らかである。例えば、上述の複数の実施形態を組み合わせてもよい。また、特に、装置の分散・統合の具体的な実施形態は以上に図示するものに限られず、その全部又は一部について、種々の付加等に応じて、又は、機能負荷に応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。 As described above, the present invention has been described using the embodiments, but the technical scope of the present invention is not limited to the scope described in the above embodiments. It is apparent to those skilled in the art that various changes or improvements can be made to the above embodiment. For example, the above embodiments may be combined. Further, in particular, the specific embodiment of the distribution / integration of the apparatus is not limited to the above illustrated one, and all or a part of the apparatus may be arbitrarily added according to various additions or the like, or according to a functional load. It can be configured to be distributed or integrated functionally or physically in units.
1・・・問合せ文出力装置、11・・・記憶部、12・・・制御部、121・・・特定部、122・・・生成部、123・・・第2変換部、124・・・第1変換部、125・・・出力部、2・・・データベースシステム
DESCRIPTION OF
Claims (8)
前記特定部により特定された複数の前記実行計画を、当該実行計画に含まれる文字列の並びと、当該実行計画に対応する前記データベースシステムにおける問合せ文に含まれる文字列の並びとの関連性に基づいて前記問合せ文に変換するとともに、当該実行計画の一部である部分実行計画を前記問合せ文に変換する第1変換部と、
前記第1変換部により変換された問合せ文を出力する出力部と、
を備える問合せ文出力装置。 A specifying unit that specifies a plurality of execution plans executed in the database system;
The plurality of execution plans identified by the identification unit are associated with a sequence of character strings included in the execution plan and a relationship between the sequence of character strings included in a query sentence in the database system corresponding to the execution plan. A first conversion unit that converts the partial execution plan that is a part of the execution plan into the query statement,
An output unit that outputs the query sentence converted by the first conversion unit;
A query output device comprising:
請求項1に記載の問合せ文出力装置。 The output unit outputs a query sentence having a high degree of similarity to another query sentence among a plurality of query sentences converted by the first conversion unit.
The query sentence output device according to claim 1.
前記第1変換部は、複数の前記実行計画のそれぞれを前記変換モデルに入力し、前記変換モデルから出力される前記問合せ文を取得することにより、複数の実行計画のそれぞれを問合せ文に変換するとともに、複数の前記部分実行計画のそれぞれを前記変換モデルに入力し、前記変換モデルから出力される前記問合せ文を取得することにより、複数の前記部分実行計画のそれぞれを問合せ文に変換する、
請求項1又は2に記載の問合せ文出力装置。 A generating unit that generates a conversion model that converts the execution plan into a query sentence,
The first conversion unit converts each of the plurality of execution plans into a query statement by inputting each of the plurality of execution plans to the conversion model and acquiring the query statement output from the conversion model. With, each of the plurality of partial execution plans is input to the conversion model, and by acquiring the query sentence output from the conversion model, each of the plurality of partial execution plans is converted into a query sentence,
The query sentence output device according to claim 1.
前記生成部は、前記変換モデルを生成し、当該変換モデルに対して前記特定部により特定された前記実行計画を入力することにより問合せ文を取得し、当該問合せ文を前記第2変換部に入力することにより、当該問合せ文に対応する実行計画を取得し、前記特定部により特定された前記実行計画と、当該変換モデルに対応する実行計画との類似度を算出し、前記変換モデルにおける設定情報を変更しながら、算出される類似度が相対的に高い変換モデルを選択する、
請求項3に記載の問合せ文出力装置。 A second conversion unit that converts the query statement into an execution plan;
The generating unit generates the conversion model, obtains a query by inputting the execution plan specified by the specifying unit for the conversion model, and inputs the query to the second conversion unit. Thereby obtaining an execution plan corresponding to the query sentence, calculating a similarity between the execution plan specified by the specifying unit and an execution plan corresponding to the conversion model, and setting information in the conversion model. While selecting a conversion model having a relatively high calculated similarity,
The query output device according to claim 3.
前記生成部は、問合せ文を前記第2変換部に入力することにより、当該問合せ文に対応する実行計画を取得し、取得した当該実行計画を前記変換モデルに対して入力することにより問合せ文を取得し、前記第2変換部に入力された問合せ文と、前記変換モデルから取得した問合せ文との類似度を算出し、前記変換モデルにおける設定情報を変更しながら、算出される当該類似度が相対的に高い変換モデルを選択する、
請求項3又は4に記載の問合せ文出力装置。 A second conversion unit that converts the query statement into an execution plan;
The generation unit obtains an execution plan corresponding to the query sentence by inputting the query sentence to the second conversion unit, and inputs the obtained execution plan to the conversion model to generate the query sentence. Calculating the similarity between the query sentence obtained and input to the second conversion unit and the query sentence obtained from the conversion model, and calculating the similarity while changing the setting information in the conversion model. Select a relatively high conversion model,
The query output device according to claim 3.
請求項4又は5に記載の問合せ文出力装置。 The second conversion unit converts the query statement into an execution plan by causing the database system to generate an execution plan corresponding to the query statement.
The query output device according to claim 4.
請求項1から6のいずれか1項に記載の問合せ文出力装置。 The identification unit, executed in the database system, to specify a plurality of execution plans having relatively high execution costs,
The query output device according to any one of claims 1 to 6.
データベースシステムにおいて実行された、複数の実行計画を特定するステップと、
特定された複数の前記実行計画を、当該実行計画に含まれる文字列の並びと、当該実行計画に対応する前記データベースシステムにおける問合せ文に含まれる文字列の並びとの関連性に基づいて前記問合せ文に変換するとともに、当該実行計画の一部である部分実行計画を前記問合せ文に変換するステップと、
前記実行計画から変換された問合せ文を出力するステップと、
を備える問合せ文出力方法。
Computer runs,
Identifying a plurality of execution plans executed in the database system;
The plurality of identified execution plans are queried based on a relevance between a sequence of character strings included in the execution plan and a sequence of character strings included in a query statement in the database system corresponding to the execution plan. And converting the partial execution plan that is a part of the execution plan into the query statement.
Outputting a query sentence converted from the execution plan;
A query sentence output method comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018136623A JP6971929B2 (en) | 2018-07-20 | 2018-07-20 | Inquiry statement output device and inquiry statement output method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018136623A JP6971929B2 (en) | 2018-07-20 | 2018-07-20 | Inquiry statement output device and inquiry statement output method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2020013448A true JP2020013448A (en) | 2020-01-23 |
JP6971929B2 JP6971929B2 (en) | 2021-11-24 |
Family
ID=69170177
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2018136623A Active JP6971929B2 (en) | 2018-07-20 | 2018-07-20 | Inquiry statement output device and inquiry statement output method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6971929B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2022029863A (en) * | 2020-08-05 | 2022-02-18 | 日本電信電話株式会社 | Optimization device, optimization method and optimization program |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011191949A (en) * | 2010-03-12 | 2011-09-29 | Hitachi Information Systems Ltd | System and program for analyzing performance |
JP2013152512A (en) * | 2012-01-24 | 2013-08-08 | Mitsubishi Electric Corp | Information processing device, information processing method and program |
JP2016091356A (en) * | 2014-11-06 | 2016-05-23 | Kddi株式会社 | Virtual database system management device, management method and management program |
JP2018180847A (en) * | 2017-04-11 | 2018-11-15 | Kddi株式会社 | Inquiry text search device, inquiry text search method, and inquiry text search program |
JP2019106039A (en) * | 2017-12-13 | 2019-06-27 | Kddi株式会社 | Database management device, database management method, and database management program |
-
2018
- 2018-07-20 JP JP2018136623A patent/JP6971929B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011191949A (en) * | 2010-03-12 | 2011-09-29 | Hitachi Information Systems Ltd | System and program for analyzing performance |
JP2013152512A (en) * | 2012-01-24 | 2013-08-08 | Mitsubishi Electric Corp | Information processing device, information processing method and program |
JP2016091356A (en) * | 2014-11-06 | 2016-05-23 | Kddi株式会社 | Virtual database system management device, management method and management program |
JP2018180847A (en) * | 2017-04-11 | 2018-11-15 | Kddi株式会社 | Inquiry text search device, inquiry text search method, and inquiry text search program |
JP2019106039A (en) * | 2017-12-13 | 2019-06-27 | Kddi株式会社 | Database management device, database management method, and database management program |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2022029863A (en) * | 2020-08-05 | 2022-02-18 | 日本電信電話株式会社 | Optimization device, optimization method and optimization program |
Also Published As
Publication number | Publication date |
---|---|
JP6971929B2 (en) | 2021-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110543517B (en) | Method, device and medium for realizing complex query of mass data based on elastic search | |
KR101525529B1 (en) | data processing apparatus and data mapping method thereof | |
CN109240901B (en) | Performance analysis method, performance analysis device, storage medium, and electronic apparatus | |
US20040158567A1 (en) | Constraint driven schema association | |
CN106874426B (en) | RDF (resource description framework) streaming data keyword real-time searching method based on Storm | |
JP2005521954A (en) | Method and apparatus for querying a relational database | |
CN104965735A (en) | Apparatus for generating upgrade SQL script | |
CN105630881A (en) | Data storage method and query method for RDF (Resource Description Framework) | |
US20110302187A1 (en) | Schema definition generating device and schema definition generating method | |
CN104573039A (en) | Keyword search method of relational database | |
US11269880B2 (en) | Retroreflective clustered join graph generation for relational database queries | |
CN104699698A (en) | Graph query processing method based on massive data | |
JP2002099561A (en) | Method and system for data conversion, and storage medium | |
Wang et al. | Cleanix: A parallel big data cleaning system | |
CN110019384A (en) | A kind of acquisition methods of blood relationship data provide the method and device of blood relationship data | |
WO2018059430A1 (en) | Database searching | |
WO2013111287A1 (en) | Sparql query optimization method | |
JP6737734B2 (en) | Query sentence search device, query sentence search method, and query sentence search program | |
JP5634374B2 (en) | Specification creation support device and program | |
JP6971929B2 (en) | Inquiry statement output device and inquiry statement output method | |
JP3630062B2 (en) | Semi-structured document search method and apparatus, and storage medium storing semi-structured document search program | |
Matuszka et al. | Geodint: towards semantic web-based geographic data integration | |
CN116383247A (en) | Large-scale graph data efficient query method | |
Rossel et al. | A Big Data Modeling Methodology for NoSQL Document Databases. | |
JP7022712B2 (en) | Query recommendation device and query recommendation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20200626 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20210525 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20210527 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20210528 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20211026 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20211102 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6971929 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |