JP6737734B2 - Query sentence search device, query sentence search method, and query sentence search program - Google Patents
Query sentence search device, query sentence search method, and query sentence search program Download PDFInfo
- Publication number
- JP6737734B2 JP6737734B2 JP2017078215A JP2017078215A JP6737734B2 JP 6737734 B2 JP6737734 B2 JP 6737734B2 JP 2017078215 A JP2017078215 A JP 2017078215A JP 2017078215 A JP2017078215 A JP 2017078215A JP 6737734 B2 JP6737734 B2 JP 6737734B2
- Authority
- JP
- Japan
- Prior art keywords
- search
- character string
- query
- execution plan
- statement
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims description 27
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 239000000284 extract Substances 0.000 claims description 9
- 238000012545 processing Methods 0.000 description 18
- 238000010586 diagram Methods 0.000 description 16
- 230000014509 gene expression Effects 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 238000007792 addition Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 239000006185 dispersion Substances 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本発明は、データベースシステムにおいて実行可能な問合せ文を検索する問合せ文検索装置、問合せ文検索方法及び問合せ文検索プログラムに関する。 The present invention relates to a query sentence search device, a query sentence search method, and a query sentence search program that search for a query sentence that can be executed in a database system.
従来、データベースシステムにおいて実行可能なSQL(Structured Query Language)等の問合せ文の履歴の中から、特定の問合せ文と問合せの内容が一致又は類似する問合せ文を検索することが行われている。特定の問合せ文に一致又は類似する問合せ文を検索する方法としては、問合せ文を文字列として扱い、文字列の類似度を測る方法がある。そして、文字列の類似度を測定する方法として、レーベンシュタイン距離を用いる方法が従来から提案されている(例えば、特許文献1参照)。レーベンシュタイン距離は、文字列を比較対象の文字列に変換する場合に要する編集の回数を示しており、0回であれば、文字列と、比較対象の文字列とが一致していることを示している。また、レーベンシュタイン距離の値が小さければ小さいほど、文字列と、比較対象の文字列との類似度が高いことを示している。 2. Description of the Related Art Conventionally, a query statement such as SQL (Structured Query Language) that can be executed in a database system is searched for a query statement in which the content of the query matches or is similar to a specific query statement. As a method for retrieving a query text that matches or is similar to a specific query text, there is a method of treating the query text as a character string and measuring the similarity of the character string. A method using the Levenshtein distance has been conventionally proposed as a method for measuring the similarity between character strings (see, for example, Patent Document 1). The Levenshtein distance indicates the number of edits required to convert a character string into a character string to be compared, and if it is 0, it means that the character string and the character string to be compared match. Showing. Also, the smaller the value of the Levenshtein distance, the higher the similarity between the character string and the character string to be compared.
しかしながら、データベースシステムにおいて実行可能な問合せ文であるSQLは、書式の自由度が高いことから、同じ内容の問合せ文であっても複数の表現方法がある。このため、文字列の類似度によって、特定の問合せ文と、問合せの内容が一致又は類似する問合せ文を正確に検索することができないという問題がある。 However, since SQL, which is a query statement that can be executed in a database system, has a high degree of freedom in format, there are multiple expression methods even for query statements having the same content. For this reason, there is a problem in that it is not possible to accurately search for a query text in which the content of the query matches or is similar to the specific query text, depending on the similarity of the character strings.
また、問合せ文では、データベースシステムにおける複数のテーブルの結合を指定する構文が含まれることがある。しかしながら、問合せ文の全体を1つの文字列として扱う場合には、問合せ文の構造を考慮した検索を行うことができない。このため、問合せ文を示す文字列の類似度を測ることによって検索を行う方法では、所定のテーブルの結合処理を含む問合せ文といった、問合せ文の一部に着目した検索を行うことができないという問題がある。 Further, the query statement may include a syntax that specifies a join of a plurality of tables in the database system. However, when the entire query text is treated as one character string, it is not possible to perform a search considering the structure of the query text. Therefore, in the method of performing a search by measuring the degree of similarity of a character string indicating a query sentence, it is not possible to perform a search focusing on a part of the query sentence, such as a query sentence including a join process of predetermined tables. There is.
そこで、本発明はこれらの点に鑑みてなされたものであり、データベースシステムにおいて実行可能な問合せ文と類似する問合せ文を精度良く検索することができる問合せ文検索装置、問合せ文検索方法及び問合せ文検索プログラムを提供することを目的とする。 Therefore, the present invention has been made in view of these points, and a query statement search device, a query statement search method, and a query statement that can accurately search a query statement similar to a query statement that can be executed in a database system. The purpose is to provide a search program.
本発明の第1の態様に係る問合せ文検索装置は、データベースシステムにおいて実行可能な問合せ文を示す検索文の入力を受け付ける入力受付部と、前記データベースシステムにおいて実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する前記問合せ文の実行計画とを関連付けて記憶する記憶部を参照し、前記検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定する特定部と、特定された実行計画に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力する出力部と、を備える。 An inquiry statement search device according to a first aspect of the present invention includes an input acceptance unit that accepts an input of a search statement indicating an inquiry statement that can be executed in a database system, a plurality of inquiry statements executed in the database system, A specifying unit that refers to a storage unit that stores an execution plan of the query statement that corresponds to each of a plurality of query statements in association with each other, and specifies an execution plan that at least partially matches the execution plan that corresponds to the search statement. And an output unit that outputs the query statement stored in the storage unit in association with the specified execution plan as a search result.
前記問合せ文検索装置は、前記記憶部に記憶されている前記実行計画に基づいて、当該実行計画に対応する問合せ文の構造を抽出し、抽出された当該構造と、当該問合せ文において参照するテーブルとを示す検索用文字列を生成する文字列生成部と、前記検索用文字列と、当該検索用文字列に対応する問合せ文とを関連付けて前記記憶部に記憶させる記憶制御部をさらに備え、前記入力受付部は、前記検索文として前記検索用文字列を受け付け、前記特定部は、前記記憶部を参照し、受け付けた前記検索文と少なくとも一部が一致する前記検索用文字列を特定し、前記出力部は、特定された検索用文字列に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力してもよい。 The inquiry statement search device extracts a structure of an inquiry statement corresponding to the execution plan based on the execution plan stored in the storage unit, and the extracted structure and a table referred to in the inquiry statement. And a storage control unit that stores the search character string in the storage unit in association with the search character string and a query sentence corresponding to the search character string. The input receiving unit receives the search character string as the search sentence, and the identifying unit refers to the storage unit and identifies the search character string that at least partially matches the received search sentence. The output unit may output the inquiry sentence stored in the storage unit in association with the specified search character string as a search result.
前記文字列生成部は、前記記憶部に記憶されている前記実行計画に基づいて、当該実行計画に対応する問合せ文の木構造を抽出し、抽出された当該木構造を、ルートとなるノードから行きがけ順及び帰りがけ順に走査することにより木構造を示す前記検索用文字列を生成してもよい。 The character string generation unit extracts a tree structure of a query statement corresponding to the execution plan based on the execution plan stored in the storage unit, and extracts the extracted tree structure from a root node. The search character string indicating the tree structure may be generated by scanning the order of travel and the order of return.
前記入力受付部は、前記検索文として前記問合せ文の入力を受け付け、前記問合せ文検索装置は、入力された前記問合せ文を前記検索用文字列に変換する変換部をさらに備え、前記特定部は、前記記憶部を参照し、変換された検索用文字列と少なくとも一部が一致する前記検索用文字列を特定してもよい。 The input receiving unit receives an input of the inquiry sentence as the search sentence, the inquiry sentence search device further comprises a conversion unit for converting the input inquiry sentence into the search character string, the specifying unit, The storage character string may be referenced to identify the search character string that at least partially matches the converted search character string.
本発明の第2の態様に係る問合せ文検索方法は、コンピュータが実行する、データベースシステムにおいて実行可能な問合せ文を示す検索文の入力を受け付けるステップと、前記データベースシステムにおいて実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する前記問合せ文の実行計画とを関連付けて記憶する記憶部を参照し、前記検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定するステップと、特定された実行計画に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力するステップと、を備える。 A query statement search method according to a second aspect of the present invention includes a step of accepting an input of a search statement that is executed by a computer and that indicates a query statement that can be executed in a database system, and a plurality of query statements executed in the database system. And an execution plan of the query statement corresponding to each of the plurality of query statements are stored in association with each other, and an execution plan at least partially matching the execution plan corresponding to the search statement is specified. And a step of outputting the inquiry statement stored in the storage unit in association with the specified execution plan as a search result.
本発明の第3の態様に係る問合せ文検索プログラムは、コンピュータを、データベースシステムにおいて実行可能な問合せ文を示す検索文の入力を受け付ける入力受付部、前記データベースシステムにおいて実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する前記問合せ文の実行計画とを関連付けて記憶する記憶部を参照し、前記検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定する特定部、及び、特定された実行計画に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力する出力部、として機能させる。 A query statement search program according to a third aspect of the present invention includes a computer, an input accepting unit that accepts an input of a search statement indicating a query statement that can be executed in a database system, and a plurality of query statements executed in the database system. Specifying a execution plan that at least partially matches the execution plan corresponding to the search statement by referring to a storage unit that associates and stores the execution plan of the query statement corresponding to each of the plurality of query statements And an output unit that outputs the query statement stored in the storage unit in association with the specified execution plan as a search result.
本発明によれば、データベースシステムにおいて実行可能な問合せ文と類似する問合せ文を精度良く検索することができるという効果を奏する。 According to the present invention, there is an effect that a query sentence similar to a query sentence that can be executed in a database system can be accurately searched.
<第1実施形態>
[問合せ文検索システムSの概要]
図1は、第1実施形態に係る問合せ文検索システムSの概要を示す図である。問合せ文検索システムSは、問合せ文検索装置1と、データベースシステム2と、端末3とを備え、検索文が示す処理に対応する問合せ文を検索するためのシステムである。
<First Embodiment>
[Outline of inquiry text search system S]
FIG. 1 is a diagram showing an outline of an inquiry sentence search system S according to the first embodiment. The inquiry text search system S includes the inquiry
問合せ文検索装置1は、データベースシステム2及び端末3と、LANやインターネット等の通信ネットワークを介して通信可能に接続されている。問合せ文検索装置1は、データベースシステム2において実行された問合せ文と、当該問合せ文に対応する実行計画とをデータベースシステム2から取得する(図1の(1))。
The inquiry
問合せ文検索装置1は、データベースシステム2から取得した実行計画に基づいて、当該実行計画に対応する問合せ文の構造を解析する(図1の(2))。問合せ文検索装置1は、解析した構造に対応する検索用文字列を生成し、当該検索用文字列と、問合せ文とを関連付けて記憶部に記憶する(図1の(3))。
Based on the execution plan acquired from the
問合せ文検索装置1は、端末3から、検索文として、検索用文字列を取得する(図1の(4))。問合せ文検索装置1は、記憶部に記憶されている検索用文字列のうち、取得した検索用文字列と類似する検索用文字列を特定する(図1の(5))。問合せ文検索装置1は、特定した検索用文字列に対応する問合せ文を特定する(図1の(6))。問合せ文検索装置1は、特定した問合せ文を、検索文に対応する検索結果として端末3に出力する(図1の(7))。
The inquiry
このように、問合せ文検索装置1は、実行計画を解析することで生成した検索用文字列に基づいて、検索文に類似する検索用文字列を特定するので、検索文が示す問合せ文と構造が類似する問合せ文を精度良く検索することができる。
以下、問合せ文検索装置1の構成について説明する。
In this way, the query
The configuration of the inquiry
[問合せ文検索装置1の構成例]
図2は、第1実施形態に係る問合せ文検索装置1の構成を示す図である。
問合せ文検索装置1は、記憶部11と、制御部12とを備える。
[Configuration Example of Query Text Retrieval Device 1]
FIG. 2 is a diagram showing the configuration of the inquiry
The inquiry
記憶部11は、例えば、ROM(Read Only Memory)及びRAM(Random Access Memory)等である。記憶部11は、問合せ文検索装置1を機能させるための各種プログラムを記憶する。記憶部11は、問合せ文検索装置1の制御部12を、後述する取得部121、文字列生成部122、記憶制御部123、入力受付部124、特定部125、及び出力部126として機能させる問合せ文検索プログラムを記憶する。
The
制御部12は、例えばCPU(Central Processing Unit)である。制御部12は、記憶部11に記憶されている各種プログラムを実行することにより、問合せ文検索装置1に係る機能を制御する。制御部12は、問合せ文検索プログラムを実行することにより、取得部121、文字列生成部122、記憶制御部123、入力受付部124、特定部125、及び出力部126として機能する。
The
取得部121は、データベースシステム2から、問合せ文と、実行計画とを取得する。問合せ文は、データベースシステム2において実行されたSQL等の問合せ文である。実行計画は、データベースシステム2が、問合せ文に対応する処理を実行する際に生成する情報である。取得部121は、取得した問合せ文と、当該問合せ文に対応する実行計画とを関連付けて問合せ履歴情報として記憶部11に記憶させる。図3は、問合せ履歴情報の一例を示す図である。図3に示すように、問合せ文と、実行計画とが関連付けられて記憶されていることが確認できる。
The
図4A〜図4Dは、問合せ文の一例を示す図である。ここで、図4Bに示す問合せ文は、図4Aに示す問合せ文と同じデータを出力するための問合せ文であり、図4Aに示す問合せ文と異なる表現である問合せ文である。 4A to 4D are diagrams illustrating examples of inquiry sentences. Here, the inquiry statement shown in FIG. 4B is an inquiry statement for outputting the same data as the inquiry statement shown in FIG. 4A, and is an expression different from the inquiry statement shown in FIG. 4A.
図5A〜図5Dは、図4A〜図4Dに示す問合せ文に対応する実行計画を示す図である。図5において最初に示される文字列「Sort」と、「−>」の後に示される文字列とは、問合せ文によって実行される処理としてのノードを示している。また、文字列「Scan」を含むノード(以下、Scanノードともいう。)に続く文字列は、参照されるテーブルのテーブル名を示している。ここで、図4Aに示す問合せ文と異なる表現である問合せ文であるものの、図5Aに示す実行計画と、図5Bに示す実行計画とが同じ実行計画であることが確認できる。 5A to 5D are diagrams showing execution plans corresponding to the inquiry statements shown in FIGS. 4A to 4D. In FIG. 5, the first character string “Sort” and the character string after “−>” indicate a node as a process executed by the query statement. Further, the character string following the node including the character string "Scan" (hereinafter, also referred to as Scan node) indicates the table name of the referenced table. Here, it can be confirmed that the execution plan shown in FIG. 5A and the execution plan shown in FIG. 5B are the same execution plan, although the query statement is an expression different from the query statement shown in FIG. 4A.
文字列生成部122は、取得部121が取得した実行計画に基づいて検索用文字列を生成する。具体的には、文字列生成部122は、記憶部11に記憶されている実行計画に基づいて、実行計画に含まれる処理を示すノードと、実行計画に対応する処理において参照されるテーブルのテーブル名を抽出する。文字列生成部122は、取得部121が取得した実行計画を示すコードの記載順序と、抽出したノード及びテーブル名とに基づいて、実行計画に対応する問合せ文の木構造を抽出する。文字列生成部122は、木構造のグラフである実行計画ツリーを生成する。
The character
図6A〜図6Dは、図5A〜図5Dに示す実行計画に対応する実行計画ツリーを示す図である。実行計画ツリーでは、各ノードにおける処理の略称を、括弧内に示している。例えば、ルートノードに対応する処理「Sort」の略称は「S」であり、処理「Group Aggregate」の略称は「GA」である。また、実行計画ツリーでは、Scanノードの下部にテーブル名を示している。ここで、図6Aに示す実行計画ツリーと、図6Bに示す実行計画ツリーとが同じ構造であることが確認できる。 6A to 6D are diagrams showing execution plan trees corresponding to the execution plans shown in FIGS. 5A to 5D. In the execution plan tree, the abbreviations of the processes in each node 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”. Further, in the execution plan tree, the table name is shown below the Scan node. Here, it can be confirmed that the execution plan tree shown in FIG. 6A and the execution plan tree shown in FIG. 6B have the same structure.
文字列生成部122は、抽出された当該木構造を示す実行計画ツリーを、ルートとなるノードから行きがけ順及び帰りがけ順に走査することにより木構造を示す検索用文字列を生成する。すなわち、文字列生成部122は、実行計画ツリーを、ルートとなるノードから行きがけ順及び帰りがけ順に走査したときに検出されたノードの略称を、検出された順番で並べた文字列を検索用文字列として生成する。
The character
ここで、文字列生成部122は、処理が重複するノードには通し番号を付与する。例えば、図6Aに示されるノードN1と、ノードN2とは、いずれも「Sort(S)」である。そこで、文字列生成部122は、ノードN1の略称を「S1」とし、ノードN2の略称を「S2」とする。また、文字列生成部122は、Scanノードに対応する略称に、当該Scanノードにおいて参照されるテーブルのテーブル名称を関連付ける。
Here, the character
図7A〜図7Dは、図6A〜図6Dに示す実行計画ツリーに対応する検索用文字列を示す図である。図7に示すように、検索用文字列では、ノードが検出された順番に、当該ノードの略称が羅列されていることが確認できる。また、図7Aに示す検索用文字列と、図7Bに示す検索用文字列とが同じ内容であることが確認できる。 7A to 7D are diagrams showing search character strings corresponding to the execution plan trees shown in FIGS. 6A to 6D. As shown in FIG. 7, in the search character string, it can be confirmed that the abbreviations of the nodes are listed in the order in which the nodes are detected. Further, it can be confirmed that the search character string shown in FIG. 7A and the search character string shown in FIG. 7B have the same content.
文字列生成部122は、記憶部11に記憶されている問合せ履歴情報に含まれる全ての問合せ文について検索用文字列を生成する。
記憶制御部123は、文字列生成部122が生成した検索用文字列と、当該検索用文字列に対応する問合せ文とを関連付けて検索用情報として記憶部11に記憶させる。図8は、第1実施形態に係る検索用情報の一例を示す図である。図8に示すように、問合せ文と、検索用変換文字列とが関連付けられて記憶されていることが確認できる。
The character
The
入力受付部124は、データベースシステム2において実行可能な問合せ文を示す検索文の入力を受け付ける。本実施形態において、入力受付部124は、端末3から、検索文として、検索用文字列を受け付ける。
The
特定部125は、データベースシステム2において実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する問合せ文の実行計画とを関連付けて記憶する記憶部11を参照し、入力受付部124が受け付けた検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定する。
The identifying
本実施形態において、特定部125は、記憶部11に記憶されている検索用情報を構成する検索用文字列を参照し、入力受付部124が受け付けた検索文と少なくとも一部が一致する検索用文字列を特定する。具体的には、特定部125は、入力受付部124が受け付けた検索文と少なくとも一部が一致するとともに、入力受付部124が受け付けた検索文に含まれるテーブルと同じテーブルのみを含んでいる検索用文字列を特定する。ここで、特定部125は、検索用文字列の比較を行う場合には、各略称に付されている通し番号を除去した状態で、検索用文字列の比較を行うものとする。
In the present embodiment, the identifying
例えば、入力受付部124が、図4Aに示す問合せ文に対応する検索用文字列、すなわち、図7Aに示す検索用文字列を検索文として受け付けた場合、特定部125は、当該検索用文字列と一致する検索用文字列として、図7Aに示す検索用文字列と、図7Bに示す検索用文字列とを特定する。したがって、特定部125は、問合せ文としての表現が異なっていても実行計画が同一であれば、同じ問合せ文とみなして検索することができる。
For example, when the
別の例として、図4Cに示す問合せ文に対応する検索用文字列、すなわち、図7Cに示す検索用文字列の一部を検索文として利用することを考える。regionテーブルとnationテーブルとを結合する処理、及び、当該結合の結果とcustomerテーブルとの結合を行う処理に注目した場合、図6Cに示す実行計画ツリーにおいて、ルートノードから2番目のノード「Nested Loop」以下の部分木が該当する。検索文は、以下のように表現される。 As another example, consider using a search character string corresponding to the query text shown in FIG. 4C, that is, a part of the search text string shown in FIG. 7C as a search text. When attention is focused on the process of joining the region table and the state table and the process of joining the result of the join and the customer table, in the execution plan tree shown in FIG. 6C, the second node “Nested Loop” from the root node is displayed. The following subtrees are applicable. The search sentence is expressed as follows.
NL BS BS HJ H SS1 SS1 H SS2 SS2 HJ NL
BS→customer,SS1→region,SS2→nation
NL BS BS HJ H SS1 SS1 H SS2 SS2 HJ NL
BS→customer, SS1→region, SS2→nation
特定部125は、上記の検索文と少なくとも一部が一致する検索用文字列として、図7Cに示す検索用文字列と、図7Dに示す検索用文字列を特定する。これは、問合せ文全体が一致するわけではないが、実行計画ツリーで問合せ文を表した場合に一部の構造を共有する類似した問合せ文を検索可能であることを示している。
The specifying
なお、従来技術である文字列の類似度を測る手法と比較するため、図4Aに示す問合せ文と、図4B〜図4Dに示す問合せ文とのレーベンシュタイン距離を示す。図9は、図4A〜図4Dに示す問合せ文の相互のレーベンシュタイン距離を示す図である。 In order to compare with the technique of measuring the similarity between character strings, which is a conventional technique, the Levenshtein distance between the inquiry sentence shown in FIG. 4A and the inquiry sentences shown in FIGS. 4B to 4D is shown. FIG. 9 is a diagram showing mutual Levenshtein distances of the inquiry sentences shown in FIGS. 4A to 4D.
レーベンシュタイン距離は、値が小さいほど文字列の類似度が高いことを表している。同じ問合せ文の場合に、レーベンシュタイン距離は0となる。図9では、図4Aに示す問合せ文と、図4Cに示す問合せ文とのレーベンシュタイン距離が小さく、これらの問合せ文の類似度が高いとされている。しかしながら、図4Aに示す問合せ文と、図4Bに示す問合せ文とは、同じ処理内容を示しているため、実際には、図4Aに示す問合せ文と、図4Bに示す問合せ文とが類似している。 The smaller the Levenshtein distance, the higher the similarity of the character string. In the case of the same inquiry sentence, the Levenshtein distance is 0. In FIG. 9, the Levenshtein distance between the inquiry sentence shown in FIG. 4A and the inquiry sentence shown in FIG. 4C is small, and the similarity between these inquiry sentences is high. However, since the inquiry text shown in FIG. 4A and the inquiry text shown in FIG. 4B show the same processing content, the inquiry text shown in FIG. 4A and the inquiry text shown in FIG. 4B are actually similar to each other. ing.
また、図4Cに示す問合せ文と、図4Dに示す問合せ文のレーベンシュタイン距離は、図4Bに示す問合せ文と、図4Cに示す問合せ文とのレーベンシュタイン距離及び図4Bに示す問合せ文と、図4Dに示す問合せ文とのレーベンシュタイン距離に比べて大きく、類似度が低いとされている。しかしながら、図4Cに示す問合せ文と、図4Dに示す問合せ文とは、共通の処理を含むため、問合せ文の全体では一致しないものの、類似度が高いといえる。したがって、レーベンシュタイン距離による類似度の検索結果の精度が、本実施形態に係る問合せ文検索装置1における検索結果の精度よりも低いことが確認できる。
In addition, the Levenshtein distances of the inquiry sentence shown in FIG. 4C and the inquiry sentence shown in FIG. 4D are the Levenshtein distance between the inquiry sentence shown in FIG. 4B and the inquiry sentence shown in FIG. 4C, and the inquiry sentence shown in FIG. 4B. The Levenshtein distance is larger than the inquiry sentence shown in FIG. 4D, and the similarity is low. However, since the query text shown in FIG. 4C and the query text shown in FIG. 4D include common processing, the query text as a whole does not match, but it can be said that the similarity is high. Therefore, it can be confirmed that the accuracy of the search result of the degree of similarity based on the Levenshtein distance is lower than the accuracy of the search result in the query
出力部126は、特定された実行計画に関連付けて記憶部11に記憶されている問合せ文を検索結果として出力する。本実施形態において、出力部126は、記憶部11に記憶されている検索用情報において、特定部125が特定した検索用文字列に関連付けられている問合せ文を検索結果として端末3に出力する。
The
[検索用情報の生成に係る処理の流れ]
続いて、問合せ文検索装置1における処理の流れについて説明する。まず、検索用情報の生成に係る問合せ文検索装置1の処理の流れについて説明する。図10は、第1実施形態に係る検索用情報の生成に係る問合せ文検索装置1の処理の流れを示すフローチャートである。
[Processing flow for generating search information]
Next, the flow of processing in the inquiry
まず、取得部121は、データベースシステム2から、問合せ文と、実行計画とを取得し(S10)、問合せ文と、実行計画とを記憶部11に記憶させる。
続いて、文字列生成部122は、記憶部11に記憶されている実行計画に基づいて、実行計画に含まれる処理を示すノードと、実行計画に対応する処理において参照されるテーブルのテーブル名を抽出する(S20)。
First, the
Next, the character
続いて、文字列生成部122は、抽出したノード及びテーブル名とに基づいて実行計画ツリーを生成する(S30)。
続いて、文字列生成部122は、生成した実行計画ツリーに基づいて、検索用文字列を生成し(S40)、当該検索用文字列と、当該検索用文字列に対応する問合せ文とを関連付けて検索用情報として記憶させる(S50)。
Next, the character
Subsequently, the character
文字列生成部122は、記憶部11に記憶されている全ての問合せ文で検索用文字列を生成したか否かを判定する(S60)。文字列生成部122は、全ての問合せ文で検索用文字列を生成したと判定すると、本フローチャートに係る処理を終了し、全ての問合せ文で検索用文字列を生成していないと判定すると、S20に処理を移す。
The character
[問合せ文の検索に係る処理の流れ]
続いて、問合せ文の検索に係る問合せ文検索装置1の処理の流れについて説明する。図11は、第1実施形態に係る問合せ文の検索に係る問合せ文検索装置1の処理の流れを示すフローチャートである。
[Process flow related to query text search]
Next, a processing flow of the inquiry
まず、入力受付部124は検索文として、検索用文字列を受け付ける(S110)。
続いて、特定部125は、記憶部11に記憶されている検索用情報を構成する検索用文字列を参照し、入力受付部124が受け付けた検索文と少なくとも一部が一致する検索用文字列を特定する(S120)。
First, the
Subsequently, the identifying
続いて、出力部126は、記憶部11に記憶されている検索用情報において、特定部125が特定した検索用文字列に関連付けられている問合せ文を特定する(S130)。そして、出力部126は、特定した問合せ文を端末3に検索結果として出力する(S140)。
Subsequently, the
[第1実施形態における効果]
以上の通り、第1実施形態に係る問合せ文検索装置1は、データベースシステム2において実行可能な問合せ文を示す検索文の入力を受け付け、データベースシステム2において実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する問合せ文の実行計画とを関連付けて記憶する記憶部11を参照し、当該検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定し、特定された実行計画に関連付けて記憶部11に記憶されている問合せ文を検索結果として出力する。
[Effects of First Embodiment]
As described above, the query
このようにすることで、問合せ文検索装置1は、問合せ文の表現形式が異なる同じ処理内容を示す問合せ文を、実行計画に基づいて同じ処理内容を示す問合せ文として扱うことができる。これにより、問合せ文検索装置1は、検索文が示す問合せ文と構造が類似する問合せ文を精度良く検索することができる。
By doing so, the query
<第2実施形態>
[検索文として問合せ文の入力を受け付ける。]
続いて、第2実施形態について説明する。第1実施形態では、検索文として検索用文字列の入力を受け付けた。これに対し、第2実施形態に係る問合せ文検索装置1は、検索文として問合せ文の入力を受け付ける点で第1実施形態に係る問合せ文検索装置1と異なる。以下に、第2実施形態に係る問合せ文検索装置1について説明する。なお、第1実施形態と同じ部分については適宜説明を省略する。
<Second Embodiment>
[Accept input of inquiry text as search text. ]
Next, the second embodiment will be described. In the first embodiment, the input of the search character string is accepted as the search text. On the other hand, the inquiry
図12は、第2実施形態に係る問合せ文検索装置1の構成を示す図である。図12に示すように、第2実施形態に係る問合せ文検索装置1は、変換部127をさらに備える。
第2実施形態において、入力受付部124は、端末3から、検索文として問合せ文の入力を受け付ける。
FIG. 12 is a diagram showing the configuration of the inquiry
In the second embodiment, the
変換部127は、入力された問合せ文を検索用文字列に変換する。例えば、変換部127は、入力された問合せ文をデータベースシステム2に送信し、当該問合せ文の実行計画の取得を要求する。データベースシステム2は、問合せ文が入力されると、当該問合せ文の実行計画を生成し、当該実行計画を問合せ文検索装置1に送信する。
The
変換部127は、データベースシステム2から実行計画を受信すると、当該実行計画に基づいて、実行計画に含まれる処理を示すノードと、実行計画に対応する処理において参照されるテーブルのテーブル名を抽出する。変換部127は、受信した実行計画を示すコードの記載順序と、抽出したノード及びテーブル名とに基づいて、実行計画に対応する問合せ文の実行計画ツリーを生成する。変換部127は、実行計画ツリーに基づいて検索用文字列を生成することにより、入力された問合せ文を検索用文字列に変換する。
Upon receiving the execution plan from the
特定部125は、記憶部11に記憶されている検索用情報を構成する検索用文字列を参照し、変換部127によって変換された検索用文字列と少なくとも一部が一致する検索用文字列を特定する。
出力部126は、記憶部11に記憶されている検索用情報において、特定部125が特定した検索用文字列に関連付けられている問合せ文を検索結果として端末3に出力する。
The identifying
The
[第2実施形態における効果]
以上の通り、第2実施形態に係る問合せ文検索装置1は、検索文として問合せ文の入力を受け付け、入力された問合せ文を検索用文字列に変換し、記憶部11に記憶されている検索用情報を参照し、変換された検索用文字列と少なくとも一部が一致する検索用文字列を特定する。
[Effects of Second Embodiment]
As described above, the inquiry
このようにすることで、端末3のユーザは、問合せ文に対応する検索用文字列を生成できなくても、問合せ文検索装置1に問合せ文を入力することにより、当該問合せ文と処理内容が類似する問合せ文を検索することができる。
By doing so, even if the user of the
以上、本発明を実施の形態を用いて説明したが、本発明の技術的範囲は上記実施の形態に記載の範囲には限定されない。上記実施の形態に、多様な変更又は改良を加えることが可能であることが当業者に明らかである。例えば、上述の複数の実施形態を組み合わせてもよい。 Although the present invention has been described using the embodiments, 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 modifications and improvements can be added to the above-described embodiment. For example, the plurality of embodiments described above may be combined.
また、上述の実施形態において、問合せ文検索装置1は、端末3から受け付けた検索用文字列と、検索用情報に含まれる検索用文字列とを比較することによって、端末3から受け付けた検索用文字列に類似する検索用文字列を特定したが、これに限らない。例えば、問合せ文検索装置1は、記憶部11に、問合せ文と、実行計画とを関連付けて記憶させておき、端末3から、実行計画の少なくとも一部を示す文字列を受け付けてもよい。そして、問合せ文検索装置1は、受け付けた文字列と少なくとも一部が一致する実行計画を特定し、特定した実行計画に対応する問合せ文を検索結果として出力してもよい。
Further, in the above-described embodiment, the inquiry
この場合において、問合せ文検索装置1は、問合せ文を受け付け、当該問合せ文を実行計画に変換してもよい。そして、問合せ文検索装置1は、変換された実行計画と少なくとも一部が一致する実行計画を特定し、特定した実行計画に対応する問合せ文を検索結果として出力してもよい。
In this case, the inquiry
また、特に、装置の分散・統合の具体的な実施形態は以上に図示するものに限られず、その全部又は一部について、種々の付加等に応じて、又は、機能負荷に応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。 Further, in particular, the specific embodiment of the dispersion/integration of the devices is not limited to the one shown in the above, and any or all of them may be arbitrarily added depending on various additions or functional loads. It can be functionally or physically distributed/integrated in units.
1・・・問合せ文検索装置、11・・・記憶部、12・・・制御部、121・・・取得部、122・・・文字列生成部、123・・・記憶制御部、124・・・入力受付部、125・・・特定部、126・・・出力部、127・・・変換部、2・・・データベースシステム、3・・・端末、S・・・問合せ文検索システム
DESCRIPTION OF
Claims (6)
前記データベースシステムにおいて実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する前記問合せ文の実行計画とを関連付けて記憶する記憶部を参照し、前記検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定する特定部と、
特定された実行計画に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力する出力部と、
を備える問合せ文検索装置。 An input receiving unit that receives an input of a search statement indicating a query statement that can be executed in the database system,
With reference to a storage unit that stores a plurality of query statements executed in the database system and an execution plan of the query statement corresponding to each of the plurality of query statements in association with each other, an execution plan corresponding to the search statement and An identification unit that identifies execution plans that at least partially match,
An output unit that outputs the query statement stored in the storage unit in association with the identified execution plan as a search result,
An inquiry sentence search device comprising:
前記検索用文字列と、当該検索用文字列に対応する問合せ文とを関連付けて前記記憶部に記憶させる記憶制御部をさらに備え、
前記入力受付部は、前記検索文として前記検索用文字列を受け付け、
前記特定部は、前記記憶部を参照し、受け付けた前記検索文と少なくとも一部が一致する前記検索用文字列を特定し、
前記出力部は、特定された検索用文字列に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力する、
請求項1に記載の問合せ文検索装置。 Based on the execution plan stored in the storage unit, a structure of a query statement corresponding to the execution plan is extracted, and a search character string indicating the extracted structure and a table referred to in the query statement A character string generation unit that generates
The storage control unit further stores the search character string and an inquiry sentence corresponding to the search character string in the storage unit in association with each other,
The input receiving unit receives the search character string as the search sentence,
The identifying unit refers to the storage unit and identifies the search character string that at least partially matches the received search sentence,
The output unit outputs the query statement stored in the storage unit in association with the specified search character string, as a search result,
The inquiry sentence search device according to claim 1.
請求項2に記載の問合せ文検索装置。 The character string generation unit extracts a tree structure of a query statement corresponding to the execution plan based on the execution plan stored in the storage unit, and extracts the extracted tree structure from a root node. Generating the search character string indicating a tree structure by scanning the order of going and the order of returning,
The inquiry sentence search device according to claim 2.
入力された前記問合せ文を前記検索用文字列に変換する変換部をさらに備え、
前記特定部は、前記記憶部を参照し、変換された検索用文字列と少なくとも一部が一致する前記検索用文字列を特定する、
請求項2又は3に記載の問合せ文検索装置。 The input receiving unit receives an input of the inquiry sentence as the search sentence,
Further comprising a conversion unit for converting the input query text into the search character string,
The specifying unit refers to the storage unit and specifies the search character string that at least partially matches the converted search character string,
The inquiry sentence search device according to claim 2.
データベースシステムにおいて実行可能な問合せ文を示す検索文の入力を受け付けるステップと、
前記データベースシステムにおいて実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する前記問合せ文の実行計画とを関連付けて記憶する記憶部を参照し、前記検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定するステップと、
特定された実行計画に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力するステップと、
を備える問合せ文検索方法。 Computer running,
A step of receiving an input of a search statement indicating a query statement that can be executed in the database system,
With reference to a storage unit that stores a plurality of query statements executed in the database system and an execution plan of the query statement corresponding to each of the plurality of query statements in association with each other, an execution plan corresponding to the search statement and Identifying execution plans that at least partly match,
Outputting a query statement stored in the storage unit in association with the specified execution plan as a search result,
A query text search method comprising:
データベースシステムにおいて実行可能な問合せ文を示す検索文の入力を受け付ける入力受付部、
前記データベースシステムにおいて実行された複数の問合せ文と、当該複数の問合せ文のそれぞれに対応する前記問合せ文の実行計画とを関連付けて記憶する記憶部を参照し、前記検索文に対応する実行計画と少なくとも一部が一致する実行計画を特定する特定部、及び、
特定された実行計画に関連付けて前記記憶部に記憶されている問合せ文を検索結果として出力する出力部、
として機能させる問合せ文検索プログラム。
Computer,
An input receiving unit that receives an input of a search statement indicating a query statement that can be executed in the database system,
With reference to a storage unit that stores a plurality of query statements executed in the database system and an execution plan of the query statement corresponding to each of the plurality of query statements in association with each other, an execution plan corresponding to the search statement and An identification unit that identifies execution plans that at least partially match, and
An output unit that outputs the query statement stored in the storage unit in association with the specified execution plan as a search result,
Query search program to function as.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017078215A JP6737734B2 (en) | 2017-04-11 | 2017-04-11 | Query sentence search device, query sentence search method, and query sentence search program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017078215A JP6737734B2 (en) | 2017-04-11 | 2017-04-11 | Query sentence search device, query sentence search method, and query sentence search program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2018180847A JP2018180847A (en) | 2018-11-15 |
JP6737734B2 true JP6737734B2 (en) | 2020-08-12 |
Family
ID=64276690
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2017078215A Expired - Fee Related JP6737734B2 (en) | 2017-04-11 | 2017-04-11 | Query sentence search device, query sentence search method, and query sentence search program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6737734B2 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6971929B2 (en) * | 2018-07-20 | 2021-11-24 | Kddi株式会社 | Inquiry statement output device and inquiry statement output method |
CN109582828A (en) * | 2018-11-30 | 2019-04-05 | 阳煤忻州通用机械有限责任公司 | The automated inquiry system of forging blank size, tolerance and weight based on VBA |
CN111460241B (en) * | 2020-04-26 | 2024-01-23 | 甬矽电子(宁波)股份有限公司 | Data query method and device, electronic equipment and storage medium |
-
2017
- 2017-04-11 JP JP2017078215A patent/JP6737734B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2018180847A (en) | 2018-11-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5661813B2 (en) | Characterization and retrieval of semantic objects | |
JP5505234B2 (en) | Character string comparison program, character string comparison device, and character string comparison method | |
Papadakis et al. | Stavies: A system for information extraction from unknown web data sources through automatic web wrapper generation using clustering techniques | |
JP5040925B2 (en) | Information extraction rule creation support system, information extraction rule creation support method, and information extraction rule creation support program | |
JP6737734B2 (en) | Query sentence search device, query sentence search method, and query sentence search program | |
KR20160124079A (en) | Systems and methods for in-memory database search | |
US7822788B2 (en) | Method, apparatus, and computer program product for searching structured document | |
KR101499441B1 (en) | Method and device for compressing, decompressing and querying document | |
JP2022073981A (en) | Source code retrieval | |
JP2002099561A (en) | Method and system for data conversion, and storage medium | |
CN103226601B (en) | A kind of method and apparatus of picture searching | |
US20140067853A1 (en) | Data search method, information system, and recording medium storing data search program | |
JP2011076364A (en) | Device and method of adjusting search result | |
JP2013084023A (en) | Specification creation support device and program | |
CN110188432B (en) | System architecture verification method, electronic device and computer-readable storage medium | |
JP6971929B2 (en) | Inquiry statement output device and inquiry statement output method | |
CN113744885B (en) | Data transmission method and equipment among multiple systems in hospital intelligent system | |
JPWO2014170965A1 (en) | Document processing method, document processing apparatus, and document processing program | |
KR102130779B1 (en) | System of providing documents for machine reading comprehension and question answering system including the same | |
JP5628365B2 (en) | Search device | |
JP5374456B2 (en) | Method of operating document search apparatus and computer program for causing computer to execute the same | |
CN117851443B (en) | SQL rule tag generation method based on artificial intelligence and readable storage medium | |
JP7111972B2 (en) | Compliance determination device and method | |
JP5060361B2 (en) | Structured document retrieval apparatus, method and program | |
Byrne | Putting hybrid cultural data on the semantic web |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190605 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20200619 |
|
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: 20200707 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20200716 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6737734 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |