JP4031947B2 - Query optimization processing device, query optimization processing method, program for causing computer to execute the method, and recording medium storing program - Google Patents
Query optimization processing device, query optimization processing method, program for causing computer to execute the method, and recording medium storing program Download PDFInfo
- Publication number
- JP4031947B2 JP4031947B2 JP2002119579A JP2002119579A JP4031947B2 JP 4031947 B2 JP4031947 B2 JP 4031947B2 JP 2002119579 A JP2002119579 A JP 2002119579A JP 2002119579 A JP2002119579 A JP 2002119579A JP 4031947 B2 JP4031947 B2 JP 4031947B2
- Authority
- JP
- Japan
- Prior art keywords
- access plan
- inquiry request
- query
- access
- database server
- 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
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
【0001】
【発明の属する技術分野】
この発明は、ラッパーアーキテクチャを用いた異種データベース統合システムにおける問い合わせ最適化処理を行う問い合わせ最適化処理装置、問い合わせ最適化処理方法、その方法をコンピュータに実行させるプログラムおよびプログラムを記録した記録媒体に関する。
【0002】
【従来の技術】
問い合わせ最適化処理は、リレーショナルデータベースにおいてSQLなどの問い合わせ言語で表現されたデータ操作要求に対して、なるべく少ない時間で回答を行うための処理である。これまでに多数の最適化処理の方法が知られている。その多くはデータ操作要求を実行するためのアクセスプランの候補を複数列挙し、コスト(回答時間)の見積もりが最小になるものを選択するという方法をとっている。このコストの見積もりにはデータ数や値の選択率のような統計情報が用いられる。
【0003】
最適化処理についての参考文献としては、[1]”An Overview of Query Optimization in Relational Systems”(Surajit Chaudhuri,PODS’98,p.34−43)がある。
【0004】
ラッパーアーキテクチャを用いて異種データベースを統合する方法については、特開2000−112982号公報「異種データベース統合システム」に開示されている。このシステムでは、1つ以上のデータベースサーバーのそれぞれが管理しているデータを1つ以上の表として管理し、統合されたシステムを1つのリレーショナルデータベースとして見立てる。統合システムに与えられる検索の問い合わせ要求は、各データベースサーバーが管理する表ごとに分解され、それぞれのデータベースサーバーに対応するラッパーモジュールから問い合わせを処理するのにかかる時間的コストおよび結果件数の予測の情報を取得し、その結果に応じて最適なアクセスプランを生成する。
【0005】
【発明が解決しようとする課題】
しかしながら、異種データベース統合システムにおける問い合わせ処理の最適化にはラッパーモジュールを通したやりとりが必要であり、最適化自体に無視できない時間がかかる場合がある。即ち、以前最適化した問い合わせと同じ問い合わせが要求された時には、以前の結果を再利用することで最適化処理にかかる時間を短縮できる。しかしながら、更新操作などにより以前の最適化結果では得られたアクセスプランがすでに最適な状態ではない可能性もあり、その場合、問い合わせに対するデータベースサーバーの応答時間が長くなる。同時に、不適切なアクセスプランを使用していることを知ることができない、という問題を生じる。
【0006】
この発明は、上述した従来技術による問題点を解消するため、ラッパーモジュールとのやりとりを行う回数を少なくしつつできるだけ最適なアクセスプランを再利用し、既に最適でない状態にあるアクセスプランの再利用を防止した最適化処理を行うことができる問い合わせ最適化処理装置、方法、及びその方法をコンピュータに実行させるプログラムを提供することを目的とする。
【0007】
【課題を解決するための手段】
上述した課題を解決し、目的を達成するため、この発明に係る問い合わせ最適化処理装置は、ラッパーアーキテクチャを用いた異種データベース統合システムに入力される問い合わせ要求の検索を最適化する問い合わせ最適化処理装置において、ユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力手段と、それぞれが1つ以上の表データを管理する1つ以上複数設けられるデータベースサーバーと、各データベースサーバーにそれぞれ対応して設けられ、検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュールと、前記問い合わせ要求入力手段からの問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュールから得られる見積もりに応じてアクセスプランを生成するアクセスプラン生成手段と、前記アクセスプラン生成手段が生成したアクセスプランに応じて各データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行手段と、前記問い合わせ要求入力手段で与えられた問い合わせと、アクセスプラン生成手段で生成されたアクセスプランの履歴を保持し、新たに与えられた問い合わせと意味的に等価な問い合わせが該履歴にあれば対応するアクセスプランを前記アクセスプラン生成手段に渡すアクセスプラン保持手段と、各データベースサーバーにそれぞれ対応して設けられ、データベースサーバーが管理する表データの内容が変化する操作が行われた時に、前記アクセスプラン保持手段に対し、該当するアクセスプランを破棄するように指示するアクセスプラン破棄手段と、を備え、前記各アクセスプラン破棄手段は、表データの内容が変化する回数の閾値が設定保持され、該表データの内容が変化する回数を検出し、該回数を前記閾値と比較して閾値を超えた場合、前記アクセスプラン保持手段に対し、該閾値を超えたアクセスプランを破棄するように指示することを特徴とする。
【0008】
この発明によれば、アクセスプラン破棄手段に閾値を設定することにより、データベースサーバーが管理するデータの内容が変化した場合であっても、直ちに検索の問い合わせ要求に対する応答にアクセスプランの変更が必要になるほどの著しい影響がない時、不必要にアクセスプランが破棄されることを防ぐことができ、最適化の効率を向上できる。
【0009】
また、この発明の問い合わせ最適化処理装置は、ラッパーアーキテクチャを用いた異種データベース統合システムに入力される問い合わせ要求の検索を最適化する問い合わせ最適化処理装置において、ユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力手段と、それぞれが1つ以上の表データを管理する1つ以上複数設けられるデータベースサーバーと、各データベースサーバーにそれぞれ対応して設けられ、検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュールと、前記問い合わせ要求入力手段からの問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュールから得られる見積もりに応じてアクセスプランを生成するアクセスプラン生成手段と、前記アクセスプラン生成手段が生成したアクセスプランに応じて各データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行手段と、前記問い合わせ要求入力手段で与えられた問い合わせと、アクセスプラン生成手段で生成されたアクセスプランの履歴を保持し、新たに与えられた問い合わせと意味的に等価な問い合わせが該履歴にあれば対応するアクセスプランを前記アクセスプラン生成手段に渡すアクセスプラン保持手段と、各データベースサーバーにそれぞれ対応して設けられ、データベースサーバーが管理する表データの内容が変化する操作が行われた時に、前記アクセスプラン保持手段に対し、該当するアクセスプランを破棄するように指示するアクセスプラン破棄手段と、を備え、前記アクセスプラン実行手段は、問い合わせ要求を実行するごとにその実行にかかった時間を計測し、前記アクセスプラン保持手段は、問い合わせの履歴とともに各アクセスプランの実行にかかった時間の最小値を保持し、前記アクセスプラン破棄手段は、実行時間の最小値に対する割合の閾値が設定され、前記アクセスプランの実行時間と最小値との比が前記閾値を超えた時に、該アクセスプラン、及び同じデータベースサーバーのデータを用いるアクセスプランに対する破棄を指示することを特徴とする。
【0010】
この発明によれば、アクセスプラン破棄手段が監視している情報以外の要因でデータベースサーバーの応答時間に著しい変化があった場合、不適切なアクセスプランを使用したことを知ることができ、不適切なアクセスプランを使用する回数を減らすことができ、最適化の効率を向上できる。
【0011】
また、この発明の問い合わせ最適化処理方法は、ラッパーアーキテクチャを用いた異種データベース統合システムに入力される問い合わせ要求の検索を最適化してデータベースサーバーに対する問い合わせを最適化する問い合わせ最適化処理方法において、問い合わせ要求入力手段がユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力工程と、ラッパーモジュールが前記問い合わせ要求により、それぞれが1つ以上の表データを管理する1つ以上複数設けられる前記データベースサーバーのそれぞれに対する検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュール処理工程と、アクセスプラン生成手段が前記問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュール処理工程により得られた見積もりに応じてアクセスプランを生成するアクセスプラン生成工程と、アクセスプラン実行手段が前記アクセスプラン生成工程で生成されたアクセスプランに応じて前記データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行工程と、アクセスプラン保持手段が前記問い合わせ要求入力工程により入力された問い合わせ要求と、前記アクセスプラン生成工程で生成されたアクセスプランを履歴として保持し、新たに入力された問い合わせ要求と意味的に等価な問い合わせが該履歴にある場合には対応するアクセスプランを前記アクセスプラン生成工程に渡すアクセスプラン保持工程と、アクセスプラン破棄手段が前記データベースサーバーが管理する表データの内容の変化を監視し、変化があった時には、前記アクセスプラン保持工程で該当するアクセスプランを破棄するように指示するアクセスプラン破棄工程とを含み、前記アクセスプラン破棄工程は、表データの内容が変化する回数の閾値が設定保持され、該表データの内容が変化する回数を検出し、該回数を前記閾値と比較して閾値を超えた場合、前記アクセスプラン保持工程により保持されている該閾値を超えたアクセスプランを破棄するように指示することを特徴とする。
【0012】
また、この発明の問い合わせ最適化処理方法は、ラッパーアーキテクチャを用いた異種データベース統合システムに入力される問い合わせ要求の検索を最適化してデータベースサーバーに対する問い合わせを最適化する問い合わせ最適化処理方法において、問い合わせ要求入力手段がユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力工程と、ラッパーモジュールが前記問い合わせ要求入力工程により入力された問い合わせ要求により、それぞれが1つ以上の表データを管理する1つ以上複数設けられるデータベースサーバーのそれぞれに対する検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュール処理工程と、アクセスプラン生成手段が前記問い合わせ要求入力工程により入力された問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュール処理工程により得られた見積もりに応じてアクセスプランを生成するアクセスプラン生成工程と、アクセスプラン実行手段が前記アクセスプラン生成工程で生成されたアクセスプランに応じて前記データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行工程と、アクセスプラン保持手段が前記問い合わせ要求入力工程により入力された問い合わせ要求と、アクセスプラン生成工程で生成されたアクセスプランを履歴として保持し、新たに入力された問い合わせ要求と意味的に等価な問い合わせが該履歴にある場合には対応するアクセスプランを前記アクセスプラン生成工程に渡すアクセスプラン保持工程と、アクセスプラン破棄手段が前記データベースサーバーが管理する表データの内容の変化を監視し、変化があった時には、前記アクセスプラン保持工程で該当するアクセスプランを破棄するように指示するアクセスプラン破棄工程とを含み、前記アクセスプラン実行工程は、問い合わせ要求を実行するごとにその実行にかかった時間を計測し、前記アクセスプラン保持工程は、問い合わせ要求の履歴とともに保持されている各アクセスプランの実行にかかった時間の最小値を保持し、前記アクセスプラン破棄工程は、実行時間の最小値に対する割合の閾値が設定され、前記アクセスプランの実行時間と最小値との比が前記閾値を超えた時に、該アクセスプラン、及び同じデータベースサーバーのデータを用いるアクセスプランに対する破棄を指示することを特徴とする。
【0013】
また、この発明に係るコンピュータに実行させるプログラムは、上記方法をコンピュータに実行させることを特徴とする。
【0014】
また、この発明に係る記録媒体は、上記プログラムを記録したことを特徴とする。
【0019】
【発明の実施の形態】
以下に添付図面を参照して、この発明に係る問い合わせ最適化処理装置、問い合わせ最適化処理方法、その方法をコンピュータに実行させるプログラムおよびプログラムを記録した記録媒体の好適な実施の形態を詳細に説明する。
【0020】
(実施の形態1)
図1は、本発明の問い合わせ最適化処理装置のシステム構成を示すブロック図である。問い合わせ最適化処理装置100には、クライアント(端末)101及び複数(図示の例では2つ)のデータベースサーバー102(102a,102b)が接続されている。
【0021】
問い合わせ最適化処理装置100は、問い合わせ要求入力手段111,アクセスプラン生成手段112,アクセスプラン保持手段113,アクセスプラン実行手段114からなる。また、データベースサーバー102aにおけるラッパーモジュール121a,アクセスプラン破棄手段122aと、データベースサーバー102bにおけるラッパーモジュール121b,アクセスプラン破棄手段122bを備える。図1において、下位装置であるデータベースサーバー102b側に設けられるラッパーモジュール121b,アクセスプラン破棄手段122bと、上位装置(問い合わせ最適化処理装置100の主要な手段)との接続構成は、データベースサーバー102a側と同一であり、記載を省略している。
【0022】
図2は、問い合わせ最適化処理装置100のハードウェア構成の具体例を示すブロック図である。ユーザーは、クライアント101から問い合わせ要求を、例えばSQL文の形式で入力する。入力された問い合わせ要求は、通信回線(LAN等)201を通じて問い合わせ最適化処理装置100を構成するアプリケーションサーバー202に送られる。アプリケーションサーバー202は、CPU203,プログラム領域及びデータ領域を有するメモリ204,記憶装置(ハードディスク等)205を有して構成される。
【0023】
(アクセスプラン生成手段112)
アクセスプラン生成手段112では、まず問い合わせ要求を処理できるアクセスプランがアクセスプラン保持手段113にあるか否かを調べる。アクセスプラン保持手段113にない場合は、以下のようにしてアクセスプランを作成する。まず、問い合わせ要求を関係代数の組合せを表現した木構造に変換する。関係代数に対応したオペレーター(処理)は以下のものである。
【0024】
Access:データベースサーバー102の表データを逐次的に取り出す。
Select:条件にしたがってデータを絞り込む。
Project:表のタプルを構成する属性の一部を取り出す。
Join: 条件にしたがって2つの表を結合する。
Union: 2つの表の和を作成する。
Intersect: 2つの表の積を作成する。
Difference: 2つの表の差を作成する。
【0025】
上記のうちAccessは、関係代数の演算子ではないが、データベースサーバー102が検索機能を備えていない時に最低限必要な機能である。
【0026】
(アクセスプラン保持手段113)
アクセスプラン保持手段113は、問い合わせ要求とアクセスプランを、例えば既知のハッシュマップ構造によりメモリ204上に保持する。この場合、ハッシュマップのキーには、例えば問い合わせ要求を表すSQL文の文字列を用いることができる。アクセスプラン保持手段113では、さらにデータベースサーバー102a,102bと、そのデータを使用しているアクセスプランのリストを関係づけた配列をメモリ204上に保持する。データベースサーバー102a,102bを一意に特定するために、例えばデータベースサーバー102a,102bに一意に割り当てたシーケンス番号を用いることができる。アクセスプランのリストは前記ハッシュマップ上の位置を示すポインターの配列を用いることができる。
【0027】
(アクセスプラン実行手段114)
アクセスプラン実行手段114は、アクセスプラン生成手段112により得られたアクセスプランにしたがって検索処理を実行する。
【0028】
(アクセスプラン破棄手段122a,122b)
アクセスプラン破棄手段122(122a,122b)は、データベースサーバー102a,102bごとに用意される。アクセスプラン破棄手段122a,122bは、ラッパーモジュール121(121a,121b)を通した操作に限らず、データベースサーバー102(102a,102b)に対してその管理する表データの内容が変化するような操作が行われた時に、アクセスプラン保持手段113にそのデータベースサーバー102(102a,102b)のデータを用いるアクセスプランを破棄するように指示する。
【0029】
内容の変更があったことを監視する手段は、データベースサーバー102a,102bの実現形態により異なる。例えば、データベースサーバー102a,102bがDBMS(データベース・マネージメント・システム)である場合は、更新操作が行われたことをもって内容の変更があったとすることができる。また、例えばデータベースサーバー102a,102bが単純なファイルであった場合は、一定の間隔でファイルのタイムスタンプを監視するというような形態が考えられる。
【0030】
アクセスプランを破棄する具体的指示としては、データベースサーバー102a,102bのシーケンス番号をアクセスプラン保持手段113に伝えることで行われる。アクセスプラン保持手段113では与えられたデータベースサーバー102a,102bのシーケンス番号によってデータベースサーバー102a,102bとアクセスプランのリストを関係づける配列から破棄すべきアクセスプランのリストを取得し、これをハッシュマップから削除する。
【0031】
次に、図3は、ある問い合わせ要求を表すSQL文をオペレーターの木構造に変換する例を示す図である。アクセスプラン生成手段112は、問い合わせを表す木構造を1つ以上作成し、それぞれの木構造について各データベースサーバー102(102a,102b)が管理している表データを使用する部分木を抜き出し、各データベースサーバー102a,102bに対応するラッパーモジュール111a,111bに見積もりを指示する。ラッパーモジュール111a,111bからの返答で部分木をデータベースサーバー102a,102bに処理させたときのコストが得られるので、それから計算されるコストが最小のものをアクセスプランとして選択する。
【0032】
SelectやJoinでラッパーモジュール121a,121bが返答したコストよりもアクセスプラン実行手段114で肩代わりしたほうがコストが低いと判定される場合は、アクセスプラン実行手段114で肩代わりした場合のコストが用いられる。
【0033】
図3に示す問い合わせ要求は、ある企業内社員データベースに対する具体例である。問い合わせ要求300は、以下の式(SQL文)で示される。
select社員.名前,部署.名称from社員,部署,社員所属
where社員.住所like‘%文京区%’
and社員所属.社員住所=社員.ID
and社員所属.部署番号=部署.ID
【0034】
この問い合わせ要求は、“住所で文京区に住んでいる人の社員の名前と、部署情報と部署名(名称)を検索する”というものである。図3に示す木構造は3分木の構造である。下位のノードの一つは、社員情報として、社員ID,名前,住所が対応付けられた表になっている表301(“社員ID+名前+住所”)をオペラントとし、この表301から住所に文京区を含むデータを絞り込むSelect(Select“住所=文京区”)をオペレーター310とするものである。
【0035】
そして、この下位ノードは、社員IDが同じであるデータについて表301と表302とを結合するJoin(Join“社員所属.社員番号=社員.ID”)であるオペレーター311から分岐している。さらに、これらの下位ノードは、社員所属が同じであるデータについて表302と表303とを結合するJoin(Join“社員所属.部署番号=部署.ID”)であるオペレーター312から分岐している。
【0036】
そして、この例では、データベースサーバー102aが社員情報であるIDと名前と住所を対応付けた表301を管理し、データベースサーバー102bが社員所属である社員番号と部署番号を対応付けた表302を管理し、さらに他のデータベースサーバー(図1には不図示)が表303を管理しているものとする。
【0037】
図4は、アクセスプランの生成過程を示すフローチャートである。以下、図示の処理内容を説明する。まず、問い合わせ要求入力手段111は、ユーザーから入力された問い合わせ要求を受け取る(ステップS401)。次に、アクセスプラン生成手段112は、この問い合わせ要求を処理できるアクセスプランがアクセスプラン保持手段113にあるか否かを問い合わせる(ステップS402)。アクセスプラン保持手段113に該当するアクセスプランがある場合には(ステップS403:Yes)、アクセスプランを生成せず処理を終了する。
【0038】
問い合わせ要求を処理できるアクセスプランがアクセスプラン保持手段113にない場合は(ステップS403:No)、問い合わせ要求を表すオペレーターの関係代数の組合せを表現した木構造を列挙する(ステップS404)。次に、木構造をひとつ取り出す(ステップS405)。
【0039】
そして、単一のデータベースサーバー(例えばデータベースサーバー102a)からデータを得られる部分木のうち未処理のものを抜き出す(ステップS406)。次に、このデータベースサーバー(102a)に対応するラッパーモジュール121aに見積もりを指示し、部分木をデータベースサーバー102aに処理させたときのコストを得る(ステップS407)。この後、未処理の部分木があれば(ステップS408:Yes)、ステップS406に復帰してこの未処理の部分木に対する処理を行う。上記ステップS406,ステップS407の処理は、ステップS405で列挙された全ての部分木に対して行われる。未処理の部分木がなくなれば(ステップS408:No)、ステップS409に移行する。
【0040】
次に、部分木のコストから木構造全体のコストを計算する(ステップS409)。そして、アクセスプラン生成手段112は、この木構造全体が最小コストであるか判断する(ステップS410)。最小であれば(ステップS410:Yes)、現在の木構造をアクセスプランの候補にする(ステップS411)。最小コストでなければ(ステップS410:No)、ステップS411をスキップする。
【0041】
次に、現在の木構造の他に等価な木構造がまだあるか検索する(ステップS412)。まだある場合には(ステップS412:Yes)、ステップS405以降の処理を再度実行する。一方、現在の木構造の他に等価な木構造がない場合には(ステップS412:No)、ステップS411で処理された現在のアクセスプランの候補をアクセスプランとして用いるべくアクセスプラン保持手段113(メモリ204)に記録し(ステップS413)、処理を終了する。
【0042】
上記構成によれば、ある問い合わせ要求から生成されたアクセスプランがアクセスプラン保持手段113に格納されている状態において、データベースサーバー102a,102bが管理するデータの内容が変化しない限り、前記問い合わせ要求と意味的に等価な問い合わせが要求された時には、新たにアクセスプランを生成することがなく問い合わせを実行することができる。したがって、問い合わせ要求の発生時において、ラッパーモジュールとのやりとりを行う回数を少なくしつつできるだけ最適なアクセスプランを再利用してデータベースサーバー102a,102bの応答時間を短時間で行えるようになる。
【0043】
(実施の形態2)
次に、本発明の問い合わせ最適化処理装置の実施の形態2について説明する。実施の形態2では、実施の形態1で説明したアクセスプラン破棄手段122の構成が異なる。
【0044】
この実施の形態2のアクセスプラン破棄手段122(122a,122b)は、メモリ204の領域として新たに、表データの内容が変化する回数に、及びこの回数として予め設定した閾値を記憶する領域が新たに加えられる。アクセスプラン破棄手段122は、内容の変更がある度にメモリ204の領域中の回数の数値を1ずつ加えた後に設定されている閾値と比較する。そして、回数の数値が閾値を超えていたらアクセスプラン保持手段113にアクセスプランの破棄を指示した上でメモリ204の回数を「0」に変更(リセット)する。
【0045】
上記構成によれば、データベースサーバー102(102a、102b)が管理するデータの内容が変化しても、直ちに検索の問い合わせ要求に対する応答にアクセスプランの変更が必要になるほどの著しい影響があるのではない場合、アクセスプラン破棄手段122(122a,122b)に閾値を設定することで不必要にアクセスプランを破棄することを防ぐことができる。
【0046】
(実施の形態3)
次に、本発明の問い合わせ最適化処理装置の実施の形態3について説明する。実施の形態3では、実施の形態1で説明したアクセスプラン保持手段113,アクセスプラン実行手段114,アクセスプラン破棄手段122(122a,122b)の構成が異なる。
【0047】
実施の形態3のアクセスプラン実行手段114は、実行の開始時と終了時に時刻カウンターの値を取得し、その値の差から実行時間を求める。この実行時間をアクセスプラン保持手段113に伝える。図2に示す汎用のコンピューターにおいては、タイマ(図示略)を用いて時刻カウンターの値を容易に得ることができる。
【0048】
アクセスプラン保持手段113は、メモリ204上のハッシュマップに保持される値に、アクセスプランのほかに最小実行時間を記録する領域が加えられる。アクセスプラン実行手段114から実行時間を伝えられたらハッシュマップから最小実行時間を取得し、実行時間と最小実行時間をアクセスプラン破棄手段122(122a,122b)に伝える。アクセスプラン破棄手段122からアクセスプランを破棄すべきであると返答された場合は、アクセスプラン保持手段113のハッシュマップから対象のアクセスプランを削除する。
【0049】
アクセスプラン破棄手段122は、実施の形態1で説明した機能に加えて、メモリ204上で閾値を保持するメモリ領域が加えられてなる。アクセスプラン破棄手段122は、アクセスプラン保持手段113から与えられた実行時間と最小実行時間の値の比を計算し、計算した比が閾値を超えていた場合は、アクセスプラン保持手段113にアクセスプランを破棄すべきであることを示す値を返答として渡す。
【0050】
上記構成によれば、アクセスプラン破棄手段122が監視している情報以外の要因でデータベースサーバー102(102a,102b)の応答時間に著しい変化があった場合、不適切なアクセスプランを使用したことを知ることができ、不適切なアクセスプランを使用する回数を減らすことができるようになる。
【0051】
(実施の形態4)
次に、本発明の問い合わせ最適化処理装置の実施の形態4について説明する。実施の形態4では、実施の形態1で説明したアクセスプラン保持手段113,アクセスプラン破棄手段122(122a,122b)の構成が異なる。
【0052】
実施の形態4におけるアクセスプラン保持手段113は、データベースサーバー102(102a,102b)とアクセスプランのリストを関係づける配列の代わりに、表とアクセスプランのリストを関係づける配列を加える。表を一意に特定するためには、例えば表にシーケンス番号を割り当てる構成とする。また、アクセスプラン破棄手段122a,122bは、表単位で内容の変化を監視し、内容が変化していたらその表のシーケンス番号をアクセスプラン保持手段113に伝える。アクセスプラン保持手段113は、表のシーケンス番号から破棄すべきアクセスプランのリストを取得し、これをメモリ204上のハッシュマップから削除する。
【0053】
上記構成によれば、データベースサーバーに対する内容の変化を表単位で観察できるようなデータベースサーバーについては表単位でアクセスプランの破棄を行うことで内容が変化していない表しか使っていないのに同じデータベースサーバーに属する別の表が変更されているために再利用可能なアクセスプランを破棄することを防ぐことができる。
【0054】
なお、本実施の形態で説明した問い合わせ最適化処理に係る方法は、予め用意されたプログラムをパーソナル・コンピュータやワークステーション等のコンピュータで実行することにより実現することができる。このプログラムは、ハードディスク、フロッピー(R)ディスク、CD−ROM、MO、DVD等のコンピュータで読み取り可能な記録媒体に記録され、コンピュータによって記録媒体から読み出されることによって実行される。またこのプログラムは、インターネット等のネットワークを介して配布することが可能な伝送媒体であってもよい。
【0055】
【発明の効果】
以上説明したように、この発明によれば、ある問い合わせ要求から生成されたアクセスプランがアクセスプラン保持手段に格納されているとき、データベースサーバーが管理するデータの内容が変化しない限り、前記問い合わせ要求と意味的に等価な問い合わせが要求された場合には、新たにアクセスプランを生成することなく問い合わせを実行することができるようになる。これにより、ラッパーモジュールとのやりとりを行う回数を少なくしつつできるだけ最適なアクセスプランを再利用でき、処理に係る時間の短縮化を図ることができるという。そして、データベースサーバーが管理するデータの内容が変化した場合であっても、直ちに検索の問い合わせ要求に対する応答にアクセスプランの変更が必要になるほどの著しい影響がない時、不必要にアクセスプランが破棄されることを防ぐことができ、最適化の効率を向上できるという効果を奏する。
【0056】
また、アクセスプラン破棄手段が監視している情報以外の要因でデータベースサーバーの応答時間に著しい変化があった場合、不適切なアクセスプランを使用したことを知ることができ、不適切なアクセスプランを使用する回数を減らすことができ、最適化の効率を向上できるという効果を奏する。
【図面の簡単な説明】
【図1】本発明の問い合わせ最適化処理装置のシステム構成を示すブロック図である。
【図2】問い合わせ最適化処理装置のハードウェア構成の具体例を示すブロック図である。
【図3】ある問い合わせ要求を表すSQL文をオペレーターの木構造に変換する例を示す図である。
【図4】アクセスプランの生成過程を示すフローチャートである。
【符号の説明】
100 問い合わせ最適化処理装置
101 クライアント(端末)
102(102a,102b) データベースサーバー
111 問い合わせ要求入力手段
112 アクセスプラン生成手段
113 アクセスプラン保持手段
114 アクセスプラン実行手段
121(121a,121b) ラッパーモジュール
122(122a,122b) アクセスプラン破棄手段
201 通信回線(LAN)
202 アプリケーションサーバー
203 CPU
204 メモリ
205 記憶装置(ハードディスク)
300 問い合わせ要求
301,302,303 表
310,311,312 オペレーター[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a query optimization processing device that performs query optimization processing in a heterogeneous database integration system using a wrapper architecture, a query optimization processing method, a program that causes a computer to execute the method, and a recording medium that records the program.
[0002]
[Prior art]
The query optimization process is a process for responding to a data operation request expressed in a query language such as SQL in a relational database in as little time as possible. Many methods of optimization processing are known so far. Many of them use a method in which a plurality of access plan candidates for executing a data operation request are listed and the one with the smallest cost (answer time) estimate is selected. For this cost estimation, statistical information such as the number of data and the value selection rate is used.
[0003]
As a reference for the optimization processing, there is [1] “An Overview of Query Optimization in Relational Systems” (Surajit Chaudhuri, PODS '98, p. 34-43).
[0004]
A method for integrating heterogeneous databases using a wrapper architecture is disclosed in Japanese Patent Application Laid-Open No. 2000-112982, “Heterogeneous Database Integration System”. In this system, data managed by each of one or more database servers is managed as one or more tables, and the integrated system is regarded as one relational database. The query query request given to the integrated system is decomposed for each table managed by each database server, and information on the estimated time cost and number of results required to process the query from the wrapper module corresponding to each database server And an optimal access plan is generated according to the result.
[0005]
[Problems to be solved by the invention]
However, optimization of query processing in a heterogeneous database integration system requires interaction through a wrapper module, and optimization itself may take time that cannot be ignored. That is, when the same query as the previously optimized query is requested, the time required for the optimization process can be shortened by reusing the previous result. However, there is a possibility that the access plan obtained by the previous optimization result due to the update operation or the like is not already in an optimal state, and in this case, the response time of the database server to the query becomes long. At the same time, the problem arises that it is impossible to know that an inappropriate access plan is being used.
[0006]
In order to solve the above-described problems caused by the conventional technology, the present invention reuses an access plan that is optimal as much as possible while reducing the number of times of interaction with the wrapper module, and reuses an access plan that is already in a non-optimal state. It is an object of the present invention to provide a query optimization processing apparatus and method capable of performing a prevented optimization process, and a program for causing a computer to execute the method.
[0007]
[Means for Solving the Problems]
In order to solve the above-described problems and achieve the object, a query optimization processing apparatus according to the present invention optimizes a search for a query request input to a heterogeneous database integration system using a wrapper architecture. , A query request input means for receiving a query request input from a user, one or more database servers each managing one or more table data, and a search server provided corresponding to each database server. A wrapper module that estimates the time cost and the estimated number of results when executing the query request, and converts the query request from the query request input means into an operator tree structure according to the estimate obtained from the wrapper module Generate an access plan An access plan generating means, an access plan executing means for issuing an inquiry request to each database server according to the access plan generated by the access plan generating means, or executing a search process instead of the database server; The access plan corresponding to the query given by the query request input means and the history of the access plan generated by the access plan generation means is stored if the query has a semantically equivalent query to the newly given query. The access plan holding means for passing the data to the access plan generating means and the access plan holding means when an operation is performed to change the contents of the table data managed by the database server. The corresponding access program An access plan discarding unit for instructing to discard the access plan, and each access plan discarding unit sets and holds a threshold value for the number of times the contents of the table data change, and sets the number of times the contents of the table data changes. If it is detected and the number of times is compared with the threshold value and the threshold value is exceeded, the access plan holding unit is instructed to discard the access plan exceeding the threshold value.
[0008]
According to the present invention, by setting a threshold value in the access plan discarding means, even when the content of data managed by the database server changes, it is necessary to immediately change the access plan in response to a search inquiry request. When there is no significant influence, it is possible to prevent the access plan from being discarded unnecessarily, and the optimization efficiency can be improved.
[0009]
Also, the query optimization processing device of the present invention is a query optimization processing device that optimizes the search for query requests input to a heterogeneous database integration system using a wrapper architecture, and that receives a query request input from a user. A request input means; one or more database servers each managing one or more table data; and a time cost for executing a query inquiry request provided for each database server. A wrapper module that estimates a prediction of the number of results, an access plan generation unit that converts an inquiry request from the inquiry request input unit into an operator tree structure, and generates an access plan according to an estimate obtained from the wrapper module; and access An inquiry request is issued to each database server according to the access plan generated by the run generation means, or an access plan execution means for executing a search process in place of the database server, and given by the inquiry request input means The inquiry and the history of the access plan generated by the access plan generation means are held, and if there is an inquiry that is semantically equivalent to the newly given inquiry in the history, the corresponding access plan is passed to the access plan generation means. When an operation that changes the contents of the table data managed by the database server is performed corresponding to each access plan holding means and each database server, the corresponding access plan is discarded for the access plan holding means. Access plastic to instruct The access plan execution means measures the time taken for each execution of the inquiry request, and the access plan holding means takes the execution of each access plan together with the history of the inquiry. The access plan discarding means sets a threshold value of a ratio to the minimum value of the execution time, and when the ratio between the execution time and the minimum value of the access plan exceeds the threshold value, the access plan discarding means An instruction to discard a plan and an access plan using data of the same database server is provided.
[0010]
According to the present invention, when there is a significant change in the response time of the database server due to a factor other than the information monitored by the access plan discarding means, it is possible to know that an inappropriate access plan has been used. The number of times of using a simple access plan can be reduced, and the optimization efficiency can be improved.
[0011]
Also, the query optimization processing method of the present invention is a query optimization processing method for optimizing a search for a query request input to a heterogeneous database integration system using a wrapper architecture to optimize a query to a database server. An inquiry request input step in which an input means receives an input of an inquiry request from a user, and a search for each of the database servers provided with one or more wrapper modules each managing one or more table data according to the inquiry request A wrapper module processing step for estimating a time cost and a prediction of the number of results when executing an inquiry request, and an access plan generation unit converts the inquiry request into an operator tree structure, An access plan generation step for generating an access plan according to the estimate obtained by the processing step, and an access plan execution means issues an inquiry request to the database server according to the access plan generated at the access plan generation step. Or an access plan execution step for executing a search process in place of the database server, an access plan holding means for inputting an inquiry request input in the inquiry request input step, and an access plan generated in the access plan generation step. An access plan holding step for holding an access plan corresponding to a newly inputted inquiry request in the history and storing the corresponding access plan to the access plan generating step; The database An access plan discarding step for instructing to discard the corresponding access plan in the access plan holding step when there is a change. The process sets and holds the threshold of the number of times the contents of the table data change, detects the number of times the contents of the table data change, and compares the number of times with the threshold to hold the access plan. An instruction is given to discard an access plan that exceeds the threshold held in the process.
[0012]
Also, the query optimization processing method of the present invention is a query optimization processing method for optimizing a search for a query request input to a heterogeneous database integration system using a wrapper architecture to optimize a query to a database server. One or more inquiry management input steps in which the input means receives an inquiry request from the user and one or more wrapper modules each manage one or more table data according to the inquiry request input in the inquiry request input step. A wrapper module processing step for estimating a time cost and a prediction of the number of results when executing a search query request to each of the database servers to be accessed, and an access plan generation means is input by the query request input step. An access plan generation step for converting the received inquiry request into an operator tree structure and generating an access plan according to the estimate obtained by the wrapper module processing step, and an access plan execution means are generated in the access plan generation step. An access plan execution step of issuing an inquiry request to the database server according to the access plan or executing a search process instead of the database server, and an access plan holding means are input by the inquiry request input step The inquiry request and the access plan generated in the access plan generation step are held as a history, and if there is an inquiry in the history that is semantically equivalent to the newly input inquiry request, the corresponding access plan is stored in the access plan. Generation process The access plan holding process to be passed and the access plan discarding means monitor changes in the contents of the table data managed by the database server, and when there is a change, instruct to discard the corresponding access plan in the access plan holding process An access plan discarding step, wherein the access plan execution step measures the time taken to execute the inquiry request every time the inquiry request is executed, and the access plan holding step holds each inquiry request history together with the history of the inquiry request. A minimum value of the time taken to execute the access plan is held, and in the access plan discarding step, a threshold value of a ratio to the minimum value of the execution time is set, and a ratio between the execution time and the minimum value of the access plan is the threshold value Use the access plan and data from the same database server An instruction to discard the access plan is provided.
[0013]
A program to be executed by a computer according to the present invention causes the computer to execute the above method.
[0014]
A recording medium according to the present invention records the above program.
[0019]
DETAILED DESCRIPTION OF THE INVENTION
Exemplary embodiments of an inquiry optimization processing apparatus, an inquiry optimization processing method, a program for causing a computer to execute the method, and a recording medium storing the program will be described in detail below with reference to the accompanying drawings. To do.
[0020]
(Embodiment 1)
FIG. 1 is a block diagram showing a system configuration of a query optimization processing apparatus according to the present invention. A client (terminal) 101 and a plurality (two in the illustrated example) of database servers 102 (102a and 102b) are connected to the query
[0021]
The query
[0022]
FIG. 2 is a block diagram illustrating a specific example of the hardware configuration of the query
[0023]
(Access plan generation means 112)
The access
[0024]
Access: The table data of the
Select: Filter data according to conditions.
Project: Extracts some of the attributes that make up the tuple of the table.
Join: Joins two tables according to conditions.
Union: Creates the sum of two tables.
Intersect: Creates the product of two tables.
Difference: Creates the difference between two tables.
[0025]
Among the above, Access is not a relational algebra operator, but is a minimum necessary function when the
[0026]
(Access plan holding means 113)
The access
[0027]
(Access plan execution means 114)
The access
[0028]
(Access plan discarding means 122a, 122b)
Access plan discarding means 122 (122a, 122b) is prepared for each of the
[0029]
Means for monitoring that the contents have changed varies depending on the implementation form of the
[0030]
A specific instruction for discarding the access plan is performed by transmitting the sequence numbers of the
[0031]
Next, FIG. 3 is a diagram illustrating an example of converting an SQL statement representing a certain inquiry request into an operator tree structure. The access
[0032]
When it is determined that the access
[0033]
The inquiry request shown in FIG. 3 is a specific example for an in-company employee database. The
select employee. Name, department. Name from employee, department, employee affiliation
where employee. Address like '% Bunkyo-ku%'
and employee affiliation. Employee address = employee. ID
and employee affiliation. Department number = Department. ID
[0034]
This inquiry request is “search for the name, department information and department name (name) of an employee of a person living in Bunkyo-ku by address”. The tree structure shown in FIG. 3 is a triple tree structure. One of the lower nodes uses, as employee information, a table 301 (“employee ID + name + address”), which is a table in which an employee ID, a name, and an address are associated with each other. The
[0035]
The lower node branches from an
[0036]
In this example, the database server 102a manages the table 301 that associates IDs, names, and addresses, which are employee information, and the
[0037]
FIG. 4 is a flowchart showing an access plan generation process. Hereinafter, the contents of the illustrated process will be described. First, the inquiry
[0038]
If there is no access plan that can process the inquiry request in the access plan holding means 113 (step S403: No), a tree structure expressing combinations of relational algebras of operators representing the inquiry request is listed (step S404). Next, one tree structure is extracted (step S405).
[0039]
Then, an unprocessed one is extracted from the subtree from which data can be obtained from a single database server (for example, the database server 102a) (step S406). Next, an estimate is instructed to the wrapper module 121a corresponding to the database server (102a), and the cost when the sub-tree is processed by the database server 102a is obtained (step S407). Thereafter, if there is an unprocessed subtree (step S408: Yes), the process returns to step S406 to perform processing on the unprocessed subtree. The processes in steps S406 and S407 are performed on all subtrees listed in step S405. If there is no unprocessed partial tree (step S408: No), the process proceeds to step S409.
[0040]
Next, the cost of the entire tree structure is calculated from the cost of the partial tree (step S409). Then, the access
[0041]
Next, it is searched whether there is still an equivalent tree structure in addition to the current tree structure (step S412). If it is still present (step S412: YES), the processing after step S405 is executed again. On the other hand, if there is no equivalent tree structure in addition to the current tree structure (step S412: No), the access plan holding means 113 (memory) is used to use the current access plan candidate processed in step S411 as an access plan. 204) (step S413), and the process ends.
[0042]
According to the above configuration, in the state where an access plan generated from a certain inquiry request is stored in the access plan holding means 113, the meaning of the inquiry request is as long as the content of data managed by the
[0043]
(Embodiment 2)
Next, a second embodiment of the inquiry optimization processing apparatus of the present invention will be described. In the second embodiment, the configuration of the access plan discarding means 122 described in the first embodiment is different.
[0044]
The access plan discarding means 122 (122a, 122b) of the second embodiment is newly provided as an area of the memory 204, a new area for storing the table data contents, and a threshold value preset as the number of times. Added to. The access plan discarding means 122 compares the number of times in the area of the memory 204 with a threshold value set after adding 1 each time the content is changed. If the number of times exceeds the threshold value, the access
[0045]
According to the above configuration, even if the contents of the data managed by the database server 102 (102a, 102b) change, there is no significant influence on the response to the search inquiry request that requires the change of the access plan immediately. In this case, it is possible to prevent the access plan from being unnecessarily discarded by setting a threshold value in the access plan discarding unit 122 (122a, 122b).
[0046]
(Embodiment 3)
Next, a third embodiment of the inquiry optimization processing apparatus of the present invention will be described. In the third embodiment, the configurations of the access
[0047]
The access
[0048]
In addition to the access plan, the access
[0049]
In addition to the functions described in the first embodiment, the access
[0050]
According to the above configuration, if there is a significant change in the response time of the database server 102 (102a, 102b) due to factors other than the information monitored by the access
[0051]
(Embodiment 4)
Next, a fourth embodiment of the inquiry optimization processing apparatus of the present invention will be described. In the fourth embodiment, the configurations of the access
[0052]
The access plan holding means 113 according to the fourth embodiment adds an array for associating the table with the list of access plans, instead of the array for associating the database server 102 (102a, 102b) with the list of access plans. In order to uniquely identify a table, for example, a sequence number is assigned to the table. Further, the access plan discarding means 122a and 122b monitor the change in contents in units of tables, and if the contents have changed, inform the access plan holding means 113 of the sequence number of the table. The access
[0053]
According to the above configuration, for database servers that can observe changes in the contents of the database server in units of tables, the same database is used even if only the tables whose contents have not changed by discarding the access plan in units of tables are used. It is possible to prevent the reusable access plan from being discarded because another table belonging to the server has been changed.
[0054]
Note that the method related to the query optimization process described in this embodiment can be realized by executing a program prepared in advance on a computer such as a personal computer or a workstation. This program is recorded on a computer-readable recording medium such as a hard disk, floppy (R) disk, CD-ROM, MO, and DVD, and is executed by being read from the recording medium by the computer. The program may be a transmission medium that can be distributed via a network such as the Internet.
[0055]
【The invention's effect】
As described above, according to the present invention, when an access plan generated from a query request is stored in the access plan holding means, the query request and the query request are changed as long as the content of data managed by the database server does not change. When a semantically equivalent query is requested, the query can be executed without generating a new access plan. As a result, the optimal access plan can be reused while reducing the number of times of interaction with the wrapper module, and the processing time can be shortened. Even if the contents of the data managed by the database server change, the access plan is unnecessarily discarded when there is no significant impact on the response to the search query request that would require a change in the access plan. This is advantageous in that the optimization efficiency can be improved.
[0056]
Also, if there is a significant change in the response time of the database server due to factors other than the information monitored by the access plan discarding means, you can know that an inappropriate access plan has been used, and The number of times of use can be reduced, and the optimization efficiency can be improved.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a system configuration of a query optimization processing apparatus according to the present invention.
FIG. 2 is a block diagram illustrating a specific example of a hardware configuration of an inquiry optimization processing device.
FIG. 3 is a diagram illustrating an example of converting an SQL sentence representing a certain inquiry request into an operator tree structure;
FIG. 4 is a flowchart showing an access plan generation process;
[Explanation of symbols]
100 Inquiry optimization processor
101 Client (terminal)
102 (102a, 102b) database server
111 Inquiry request input means
112 Access plan generation means
113 Access plan holding means
114 Access plan execution means
121 (121a, 121b) wrapper module
122 (122a, 122b) Access plan discarding means
201 Communication line (LAN)
202 Application server
203 CPU
204 memory
205 Storage device (hard disk)
300 Inquiry request
Table 301, 302, 303
310, 311, 312 Operator
Claims (6)
ユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力手段と、
それぞれが1つ以上の表データを管理する1つ以上複数設けられるデータベースサーバーと、
各データベースサーバーにそれぞれ対応して設けられ、検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュールと、
前記問い合わせ要求入力手段からの問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュールから得られる見積もりに応じてアクセスプランを生成するアクセスプラン生成手段と、
前記アクセスプラン生成手段が生成したアクセスプランに応じて各データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行手段と、
前記問い合わせ要求入力手段で与えられた問い合わせと、アクセスプラン生成手段で生成されたアクセスプランの履歴を保持し、新たに与えられた問い合わせと意味的に等価な問い合わせが該履歴にあれば対応するアクセスプランを前記アクセスプラン生成手段に渡すアクセスプラン保持手段と、
各データベースサーバーにそれぞれ対応して設けられ、データベースサーバーが管理する表データの内容が変化する操作が行われた時に、前記アクセスプラン保持手段に対し、該当するアクセスプランを破棄するように指示するアクセスプラン破棄手段と、
を備え、
前記各アクセスプラン破棄手段は、
表データの内容が変化する回数の閾値が設定保持され、該表データの内容が変化する回数を検出し、該回数を前記閾値と比較して閾値を超えた場合、前記アクセスプラン保持手段に対し、該閾値を超えたアクセスプランを破棄するように指示することを特徴とする問い合わせ最適化処理装置。In a query optimization processing device that optimizes search for query requests input to a heterogeneous database integration system using a wrapper architecture,
An inquiry request input means for receiving an input of an inquiry request from a user;
One or more database servers each managing one or more table data; and
A wrapper module that is provided for each database server and estimates the time cost and the number of results when executing a search query request,
An access plan generating means for converting an inquiry request from the inquiry request input means into an operator tree structure and generating an access plan according to an estimate obtained from the wrapper module;
An access plan executing means for issuing an inquiry request to each database server according to the access plan generated by the access plan generating means, or executing a search process instead of the database server;
The inquiry given by the inquiry request input means and the history of the access plan generated by the access plan generation means are held, and if there is an inquiry that is semantically equivalent to the newly given inquiry in the history, the corresponding access Access plan holding means for passing the plan to the access plan generating means;
Access provided corresponding to each database server and instructing the access plan holding means to discard the corresponding access plan when an operation that changes the contents of the table data managed by the database server is performed. Plan discarding means,
With
Each access plan discarding means includes:
When the threshold of the number of times the contents of the table data change is set and held, the number of times the contents of the table data change is detected, and when the number of times exceeds the threshold, the access plan holding means Inquiry optimization processing apparatus characterized by instructing to discard an access plan exceeding the threshold .
ユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力手段と、
それぞれが1つ以上の表データを管理する1つ以上複数設けられるデータベースサーバーと、
各データベースサーバーにそれぞれ対応して設けられ、検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュールと、
前記問い合わせ要求入力手段からの問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュールから得られる見積もりに応じてアクセスプランを生成するアクセスプラン生成手段と、
前記アクセスプラン生成手段が生成したアクセスプランに応じて各データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行手段と、
前記問い合わせ要求入力手段で与えられた問い合わせと、アクセスプラン生成手段で生成されたアクセスプランの履歴を保持し、新たに与えられた問い合わせと意味的に等価な問い合わせが該履歴にあれば対応するアクセスプランを前記アクセスプラン生成手段に渡すアクセスプラン保持手段と、
各データベースサーバーにそれぞれ対応して設けられ、データベースサーバーが管理する表データの内容が変化する操作が行われた時に、前記アクセスプラン保持手段に対し、該当するアクセスプランを破棄するように指示するアクセスプラン破棄手段と、
を備え、
前記アクセスプラン実行手段は、問い合わせ要求を実行するごとにその実行にかかった時間を計測し、
前記アクセスプラン保持手段は、問い合わせの履歴とともに各アクセスプランの実行にかかった時間の最小値を保持し、
前記アクセスプラン破棄手段は、実行時間の最小値に対する割合の閾値が設定され、前記アクセスプランの実行時間と最小値との比が前記閾値を超えた時に、該アクセスプラン、及び同じデータベースサーバーのデータを用いるアクセスプランに対する破棄を指示することを特徴とする問い合わせ最適化処理装置。 In a query optimization processing device that optimizes search for query requests input to a heterogeneous database integration system using a wrapper architecture,
An inquiry request input means for receiving an input of an inquiry request from a user;
One or more database servers each managing one or more table data; and
A wrapper module that is provided for each database server and estimates the time cost and the number of results when executing a search query request,
An access plan generating means for converting an inquiry request from the inquiry request input means into an operator tree structure and generating an access plan according to an estimate obtained from the wrapper module;
An access plan executing means for issuing an inquiry request to each database server according to the access plan generated by the access plan generating means, or executing a search process instead of the database server;
The inquiry given by the inquiry request input means and the history of the access plan generated by the access plan generation means are held, and if there is an inquiry that is semantically equivalent to the newly given inquiry in the history, the corresponding access Access plan holding means for passing the plan to the access plan generating means;
Access provided corresponding to each database server and instructing the access plan holding means to discard the corresponding access plan when an operation that changes the contents of the table data managed by the database server is performed. Plan discarding means,
With
The access plan execution means measures the time taken to execute each time an inquiry request is executed,
The access plan holding means holds a minimum value of time taken to execute each access plan together with a history of inquiries,
The access plan discarding means sets a threshold value of a ratio with respect to the minimum value of the execution time, and when the ratio between the execution time and the minimum value of the access plan exceeds the threshold value, the access plan and data of the same database server A query optimization processing device that instructs to discard an access plan that uses .
問い合わせ要求入力手段がユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力工程と、An inquiry request input process in which an inquiry request input means receives an input of an inquiry request from a user;
ラッパーモジュールが前記問い合わせ要求により、それぞれが1つ以上の表データを管理する1つ以上複数設けられる前記データベースサーバーのそれぞれに対する検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュール処理工程と、The wrapper module estimates a time cost and a prediction of the number of results when executing a query query request for each of the database servers that are provided with one or more, each managing one or more table data according to the query request. A wrapper module processing step;
アクセスプラン生成手段が前記問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュール処理工程により得られた見積もりに応じてアクセスプランを生成するアクセスプラン生成工程と、An access plan generating step in which the access plan generating means converts the inquiry request into an operator tree structure and generates an access plan according to the estimate obtained by the wrapper module processing step;
アクセスプラン実行手段が前記アクセスプラン生成工程で生成されたアクセスプランに応じて前記データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行工程と、An access plan execution unit that issues an inquiry request to the database server according to the access plan generated in the access plan generation step, or executes a search process instead of the database server;
アクセスプラン保持手段が前記問い合わせ要求入力工程により入力された問い合わせ要求と、前記アクセスプラン生成工程で生成されたアクセスプランを履歴として保持し、新たに入力された問い合わせ要求と意味的に等価な問い合わせが該履歴にある場合には対応するアクセスプランを前記アクセスプラン生成工程に渡すアクセスプラン保持工程と、The access plan holding means holds the inquiry request input in the inquiry request input step and the access plan generated in the access plan generation step as a history, and there is an inquiry that is semantically equivalent to the newly input inquiry request. An access plan holding step of passing the corresponding access plan to the access plan generation step if it is in the history;
アクセスプラン破棄手段が前記データベースサーバーが管理する表データの内容の変化を監視し、変化があった時には、前記アクセスプラン保持工程で該当するアクセスプランを破棄するように指示するアクセスプラン破棄工程とを含み、An access plan discarding step for monitoring a change in the contents of the table data managed by the database server and instructing to discard the corresponding access plan in the access plan holding step when there is a change; Including
前記アクセスプラン破棄工程は、The access plan discarding step includes
表データの内容が変化する回数の閾値が設定保持され、該表データの内容が変化する回数を検出し、該回数を前記閾値と比較して閾値を超えた場合、前記アクセスプラン保持工程により保持されている該閾値を超えたアクセスプランを破棄するように指示することを特徴とする問い合わせ最適化処理方法。The threshold of the number of times the contents of the table data change is set and held, the number of times the contents of the table data change is detected, and when the number of times exceeds the threshold compared with the threshold, the threshold is held by the access plan holding step A query optimization processing method characterized by instructing to discard an access plan that exceeds the threshold value.
問い合わせ要求入力手段がユーザーからの問い合わせ要求の入力を受ける問い合わせ要求入力工程と、An inquiry request input process in which an inquiry request input means receives an input of an inquiry request from a user;
ラッパーモジュールが前記問い合わせ要求入力工程により入力された問い合わせ要求により、それぞれが1つ以上の表データを管理する1つ以上複数設けられるデータベースサーバーのそれぞれに対する検索の問い合わせ要求を実行するときの時間的コストと結果件数の予測を見積もるラッパーモジュール処理工程と、The time cost when the wrapper module executes a query query request for each of one or more database servers each managing one or more table data according to the query request input in the query request input step. And a wrapper module processing process to estimate the number of results,
アクセスプラン生成手段が前記問い合わせ要求入力工程により入力された問い合わせ要求をオペレーターの木構造に変換して、ラッパーモジュール処理工程により得られた見積もりに応じてアクセスプランを生成するアクセスプラン生成工程と、An access plan generating step in which the access plan generating means converts the inquiry request input in the inquiry request input step into an operator tree structure, and generates an access plan according to the estimate obtained by the wrapper module processing step;
アクセスプラン実行手段が前記アクセスプラン生成工程で生成されたアクセスプランに応じて前記データベースサーバーに対して問い合わせ要求を発行する、又は前記データベースサーバーの代わりに検索処理を実行するアクセスプラン実行工程と、An access plan execution unit that issues an inquiry request to the database server according to the access plan generated in the access plan generation step, or executes a search process instead of the database server;
アクセスプラン保持手段が前記問い合わせ要求入力工程により入力された問い合わせ要求と、アクセスプラン生成工程で生成されたアクセスプランを履歴として保持し、新たにThe access plan holding means holds the inquiry request input in the inquiry request input step and the access plan generated in the access plan generation step as a history, and newly 入力された問い合わせ要求と意味的に等価な問い合わせが該履歴にある場合には対応するアクセスプランを前記アクセスプラン生成工程に渡すアクセスプラン保持工程と、An access plan holding step of passing a corresponding access plan to the access plan generation step when there is a query in the history that is semantically equivalent to the input query request;
アクセスプラン破棄手段が前記データベースサーバーが管理する表データの内容の変化を監視し、変化があった時には、前記アクセスプラン保持工程で該当するアクセスプランを破棄するように指示するアクセスプラン破棄工程とを含み、An access plan discarding step for monitoring a change in the contents of the table data managed by the database server and instructing to discard the corresponding access plan in the access plan holding step when there is a change; Including
前記アクセスプラン実行工程は、問い合わせ要求を実行するごとにその実行にかかった時間を計測し、The access plan execution step measures the time taken for each execution of an inquiry request,
前記アクセスプラン保持工程は、問い合わせ要求の履歴とともに保持されている各アクセスプランの実行にかかった時間の最小値を保持し、The access plan holding step holds a minimum value of time taken to execute each access plan held together with a history of inquiry requests,
前記アクセスプラン破棄工程は、実行時間の最小値に対する割合の閾値が設定され、前記アクセスプランの実行時間と最小値との比が前記閾値を超えた時に、該アクセスプラン、及び同じデータベースサーバーのデータを用いるアクセスプランに対する破棄を指示することを特徴とする問い合わせ最適化処理方法。In the access plan discarding step, a threshold of a ratio with respect to the minimum value of the execution time is set, and when the ratio between the execution time and the minimum value of the access plan exceeds the threshold, the access plan and the data of the same database server A query optimization processing method characterized by instructing to discard an access plan that uses.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002119579A JP4031947B2 (en) | 2002-04-22 | 2002-04-22 | Query optimization processing device, query optimization processing method, program for causing computer to execute the method, and recording medium storing program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002119579A JP4031947B2 (en) | 2002-04-22 | 2002-04-22 | Query optimization processing device, query optimization processing method, program for causing computer to execute the method, and recording medium storing program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2003316811A JP2003316811A (en) | 2003-11-07 |
| JP4031947B2 true JP4031947B2 (en) | 2008-01-09 |
Family
ID=29536098
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002119579A Expired - Fee Related JP4031947B2 (en) | 2002-04-22 | 2002-04-22 | Query optimization processing device, query optimization processing method, program for causing computer to execute the method, and recording medium storing program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP4031947B2 (en) |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4850580B2 (en) * | 2006-05-22 | 2012-01-11 | 株式会社野村総合研究所 | Data processing system |
| JP4850581B2 (en) * | 2006-05-22 | 2012-01-11 | 株式会社野村総合研究所 | Data processing system |
| US8868546B2 (en) * | 2011-09-15 | 2014-10-21 | Oracle International Corporation | Query explain plan in a distributed data management system |
| JP5996390B2 (en) * | 2012-11-19 | 2016-09-21 | 株式会社三菱東京Ufj銀行 | Database management device |
| US9229983B2 (en) * | 2012-11-30 | 2016-01-05 | Amazon Technologies, Inc. | System-wide query optimization |
| JP6337741B2 (en) * | 2014-10-31 | 2018-06-06 | 富士通株式会社 | Control program, control device, control method, and database system |
| JP6523823B2 (en) * | 2015-06-26 | 2019-06-05 | Kddi株式会社 | Virtual database system management apparatus, management method and management program |
| JP2017097639A (en) * | 2015-11-25 | 2017-06-01 | 富士通株式会社 | Database control program, database control apparatus and database control method |
| CN113076332B (en) * | 2021-03-25 | 2023-08-01 | 东北大学 | A method for executing database precompiled query statements |
-
2002
- 2002-04-22 JP JP2002119579A patent/JP4031947B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2003316811A (en) | 2003-11-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP4132441B2 (en) | Data management device for managed objects | |
| US8688686B2 (en) | SQL queries for simple network management protocol management information base tables | |
| US6360214B1 (en) | Automatic database statistics creation | |
| CN100544282C (en) | A fault correlation analysis system and method | |
| US6748374B1 (en) | Method for generating a relational database query statement using one or more templates corresponding to search conditions in an expression tree | |
| US6886016B2 (en) | Method and system for supporting multivalue attributes in a database system | |
| US6625615B2 (en) | Data processing system and method for multi-level directory searches | |
| US6366901B1 (en) | Automatic database statistics maintenance and plan regeneration | |
| US6834286B2 (en) | Method and system for representing and accessing object-oriented data in a relational database system | |
| CN108733727B (en) | Query processing method, data source registration method and query engine | |
| US20030055813A1 (en) | Query optimization by sub-plan memoization | |
| US10169491B2 (en) | Query servicing with access path security in a relational database management system | |
| CN111627552A (en) | Medical streaming data blood relationship analysis and storage method and device | |
| WO2021030138A1 (en) | Cost-based optimization for document-oriented database queries | |
| CN113515564B (en) | J2 EE-based data access method, device, equipment and storage medium | |
| CN109213826B (en) | Data processing method and device | |
| JP4031947B2 (en) | Query optimization processing device, query optimization processing method, program for causing computer to execute the method, and recording medium storing program | |
| CN113032465B (en) | Data query method and device, electronic equipment and storage medium | |
| US7596584B2 (en) | Predicate based group management | |
| KR101836314B1 (en) | System and Method for Triple Auto Transform of RDBMS Data | |
| CN118886056A (en) | A data security management method and device based on multiple databases | |
| CN111680036B (en) | Configuration management database based on graph storage | |
| CN116662458B (en) | Real-time tag processing method and device, electronic equipment and storage medium | |
| US7779057B2 (en) | Method and apparatus for retrieving and sorting entries from a directory | |
| KR102910749B1 (en) | Relational metadata collection system and method in cloud environment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20041022 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070717 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070914 |
|
| 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: 20071016 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20071022 |
|
| R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101026 Year of fee payment: 3 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111026 Year of fee payment: 4 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121026 Year of fee payment: 5 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131026 Year of fee payment: 6 |
|
| LAPS | Cancellation because of no payment of annual fees |