JP3819695B2 - Database management system and query processing method - Google Patents

Database management system and query processing method Download PDF

Info

Publication number
JP3819695B2
JP3819695B2 JP2000309450A JP2000309450A JP3819695B2 JP 3819695 B2 JP3819695 B2 JP 3819695B2 JP 2000309450 A JP2000309450 A JP 2000309450A JP 2000309450 A JP2000309450 A JP 2000309450A JP 3819695 B2 JP3819695 B2 JP 3819695B2
Authority
JP
Japan
Prior art keywords
node
processing
data
nodes
request
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
Application number
JP2000309450A
Other languages
Japanese (ja)
Other versions
JP2001147845A (en
Inventor
正士 土田
幸生 中野
信男 河村
和義 根岸
俊一 鳥居
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Family has litigation
First worldwide family litigation filed litigation Critical https://patents.darts-ip.com/?family=18789606&utm_source=google_patent&utm_medium=platform_link&utm_campaign=public_patent_search&patent=JP3819695(B2) "Global patent litigation dataset” by Darts-ip is licensed under a Creative Commons Attribution 4.0 International License.
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2000309450A priority Critical patent/JP3819695B2/en
Publication of JP2001147845A publication Critical patent/JP2001147845A/en
Application granted granted Critical
Publication of JP3819695B2 publication Critical patent/JP3819695B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【産業上の利用分野】
本発明は、デ−タベ−ス処理装置に関し、特に、リレ−ショナルデ−タベ−ス管理システムに適した問合せの並列処理に好適な問合せ処理方法に関する。
【0002】
【従来の技術】
デ−タベ−ス管理システム(以下DBMSと略記)、特に、リレ−ショナルDBMSは、非手続き的な言語で表現された問合せを処理し、内部処理手順を決定し、内部処理手順に従って実行する。このデータベース言語としては、SQLが用いられる(Database Language SQL ISO 9075:1989)。従来の問合せ処理の主な方法には、予め設定した規則に基づいて単一の内部処理手順を決定するものと、各種統計情報を用いて選定された複数の候補処理手順から、コスト評価により、最適と思われるものを決定するものとがある。前者は、処理手順作成のための負荷は小さいけれども、一律に設定された規則の妥当性に問題があり、選ばれた内部処理手順の最適性にも問題がある。後者は、各種統計情報の管理し、複数の候補処理手順の作成し、それらのコスト評価のための負荷を算出して最適な処理手順を与える。上記両者の組合せ技術としては、例えば、Satoh,K.,et.al."Local and Global Optimization Mechanisms for Relational Database", Proc. VLDB, 1985.がある。該従来技術では、問い合わせの条件からデータ量を推定して処理手順を決めている。
【0003】
また、多くのDBMSは、問合せ解析処理と問合せ実行処理との2フェーズの処理を経て、問合せ処理が実現される。ホスト言語(COBOL、PL/I等)に問合せ言語を組み込む場合、当アプリケ−ションプログラム実行前に予め問合せを問合せ解析処理し、実行形式である1つの内部処理手順を作成している。この問合せ表現では、多くの場合、検索条件式にはホスト言語の変数が記述される。この変数に定数が代入されるのは、既に問合せ解析処理された結果の内部処理手順の実行時、すなわち、問合せ実行時である。この場合の問題点としては、変数に代入される値に従って複数の最適な処理手順が考えられることである。この問題を解決するために、問合せ実行処理時に複数の処理手順を作成しておき、問合せ実行時に変数に代入された値に従って処理手順を選択するものがある。コードの技術に関するものとしては、特開平1−194028号公報、および、Graefe,G.,et.al."Dynamic Query Evaluation Plans", Proc. ACM-SIGMOD, 1989.に記載されている技術がある。
【0004】
さらに、CPU性能、ディスク容量の延びを上回るような、トランザクション量の増大、データベース量の増大に対応して、スケーラブルな並列データベースシステムの提供がユーザから望まれている。データベースシステムに対するユーザの性能要件として、数万を超える同時実行ユーザ数への対応、テラバイト単位の検索トランザクションの出現、表サイズに比例しない応答時間の保証がある。並列データベースシステムは、近年のハードウェアコストの低減と相まって、注目を浴びている。並列データベースシステムについては、DeWitt,D.,et.al.:"Parallel Database Systems: The Future of High Performance Database Systems", CACM, Vol.35, No.6, 1992.に記載の技術がある。そのようなシステムでは、密結合あるいは疎結合にプロセッサを接続し、データベース処理を複数のプロセッサに静的/動的に処理を配分し、スケジュールする必要がある。並列度を増せば応答性能は向上するが、過度の並列度は逆にオーバヘッドの増大、他トランザクションの応答時間の延び等の影響がある。そのため、適度な並列度の設定が重要である。
【0005】
デ−タベ−ス処理において、処理対象となるデ−タは、二次記憶装置上に存在し、各デ−タベ−ス演算に対して大量デ−タの読み出しおよび転送が必要となる。並列デ−タベ−スシステムにおいても、転送するデ−タが大量となる場合、デ−タ転送時間がデ−タベ−スシステムの性能ネックとなる。そこで、二次記憶装置からデ−タを転送する時間を有効活用する方法が考えられる。これは、デ−タの転送時間と当該デ−タに対するデ−タベ−ス処理に要する時間とをオ−バラップさせるものであり、従来技術として良く知られている。この方式は、相互結合ネットワークで接続されるプロセッサ群間のデータ転送にも適用可能である。
【0006】
【発明が解決しようとする課題】
上記従来技術において、問合せ最適化処理とは、ユ−ザが入力した問合せからデ−タベ−スシステムの各種統計情報を基にし、最も効率の良い処理手順をDBMSが自動判定するものである。さらに、問合せの選択条件式に変数が埋め込まれている場合には、複数の処理手順を問合せ解析時に展開しておき、問合せ実行時に当変数に代入される値に従って処理手順を選択することによって、最適な処理手順が選択される。
【0007】
並列データベース処理では、各ノード(プロセッサあるいはプロセッサとディスク装置との対)へデータベース演算が分割され、各ノードで各データベース演算が並列にあるいはパイプライン的に動作する。上記従来技術によれば、この並列処理形態でも、各ノードで処理手順を選択する方法は適用可能である。
【0008】
しかし、並列に動作する処理では、同時間にそれぞれのノードが並行処理をするが、各ノードで実行するデータベース演算に対応して各ノード数を決定できないという問題がある。すなわち、ノード数を決定する基準が明確でないために、過度の並列化は逆にオーバヘッドの増大等の影響があり、最適に負荷分散することが困難である。
【0009】
また、パイプライン動作させる処理では各ノードへデータベース演算が分割格納されるが、データの分割にバラツキが存在する場合、各ノードへの均等分割方法が明確でない。
【0010】
さらに、処理時間の制約があったときなどのように、その時間内で複数の処理を行う場合において、各ノードで実行する各データベース演算をパラメータ化し、期待する処理時間に基づいて時間調整(チューニング)をする方法も明確でない。
【0011】
本発明の目的は、問合せ処理を高速化する問い合わせ処理方法およびデータベースシステムを提供することにある。
【0012】
【課題を解決するための手段】
本発明は、上記課題を解決するために、データベース処理を実行する複数のノードを備え、該複数のノードは、ネットワークを介して他のノードと接続されるデータベース管理システムであって、問い合わせ対象のデータベースを分散させて格納する記憶手段と、該記憶手段から情報を取り出して他のノードに取り出した情報を分配する分配手段を備える分配ノードと、該分配ノードから分配された情報を並び替える並び替え手段と、該並び替えられた情報が複数ある場合にはそれらをマージするマージ手段と、該マージされた情報に基づいて問い合わせに対する突き合わせを実行する突き合わせ手段とを備える結合ノードと、前記問い合わせを受け付けて、該問い合わせを解析して問い合わせの処理手順を作成する解析手段と、該解析手段の問い合わせの解析結果に基づいて実行処理を行う分配ノードおよび結合ノードを決定する決定手段と、前記結合ノードから得られた、問い合わせに対する結果を出力する出力手段とを備える決定管理ノードとを備える。
【0013】
前記決定手段は、前記解析手段の問い合わせの解析結果に基づいて前記分配ノードを決定し、前記分配ノードにおける予想される処理時間を算出し、該処理時間に基づいて結合ノードを決定することができる。
【0014】
前記決定手段は、前記決定された分配ノードにおける予想される取り出し情報量に基づいて、前記結合ノードへの前記取り出し情報の分配を前記各結合ノードに均等に割当てるようにする。
【0015】
前記決定管理ノードは、前記決定手段において前記結合ノードに取り出し情報を均等に割当てるための、前記各ノードの記憶手段の情報に関する最適化情報を記憶している記憶手段を備えることができる。
【0016】
前記決定管理ノードは、前記決定手段において前記結合ノードに取り出し情報を均等に割当てるためにあらかじめ定められたハッシュ関数を利用する。
【0017】
また、前記複数のノードは、それぞれ独立に処理を行い、前記結合ノードは、前記分配ノードからの分配された情報を逐次入力し、入力された情報ごとに処理を行う。
【0018】
さらに、前記分配ノードは、該分配ノードで分配する情報を並び替える並び替え手段を有するようにしてもよい。
【0019】
前記決定手段は、前記分配ノードにおける予想される処理時間の算出結果から、より先に処理が終了する分配ノードに対して分配処理後に前記分配ノードの並び替え手段において並び替えをするように決定することができる。
【0020】
前記決定手段は、前記処理時間に基づいて決定した前記結合ノードの台数を、所定数増加させるように決定する。
【0021】
前記結合ノードの並び替え手段は、並び替え処理の終了後にマージ処理をする機能を備えるようにしてもよい。前記突き合わせ手段は、前記マージ処理をする機能を備えるようにしてもよい。
【0022】
前記決定手段は、前記突き合わせ手段および前記出力手段における予想される処理時間を算出し、該算出結果に基づいて、前記出力手段の処理時間が、前記突き合わせ手段の処理時間より大きい場合には、前記突き合わせ手段に前記マージ処理を行わせるように決定する。
【0023】
また、本発明は、上記課題を解決するために、ネットワークを介して相互に接続される複数のノードを備えるデータベース管理システムであって、データベースを構成するデータを分散して格納する記憶手段を備え、指示されたときに、前記記憶手段に格納されたデータを取り出し、取り出したデータを他のノードに分配すべく前記ネットワークに送出する複数の第1のノードと、指示されたときに、前記ネットワークに送出されたデータを受け取り、受け取ったデータに対するデータベース演算を実行し、その結果を前記ネットワークに送出する複数の第2のノードと、ユーザからの問い合わせを受け付けて、該問い合わせを解析し、該解析結果に基づいて、前記複数の第1のノードのうち少なくとも一つの第1のノードに対して前記データの取りだしを指示し、前記第2のノードのうち少なくとも一つの第2のノードに対して前記データベース演算の実行を指示し、前記ネットワーク上に送出された演算結果を受け取り、前記問い合わせに対する結果を出力する第3のノードとを有する。
【0024】
前記第3のノードは、受け付けた問い合わせの解析結果に基づいて、前記データの取りだしを指示する第1のノードを決定し、当該第1のノードにおける予想される処理時間を算出し、該処理時間に基づいて前記データベース演算の実行を指示する第2のノードを決定することができる。
【0025】
前記第3のノードは、前記決定された第1のノードにおける、予想される取り出しデータ量に基づいて、前記決定された第2のノードへの前記取り出しデータの分配を当該決定された第2のノードに均等に割当てるようにする。
【0026】
前記第3のノードは、前記決定された第2のノードに取り出しデータを均等に割当てるための、前記各ノードの記憶手段のデータに関する最適化情報を記憶している記憶手段を備えることができる。
【0027】
前記第3のノードは、前記決定された第2のノードに取り出しデータを均等に割当てるためにあらかじめ定められたハッシュ関数を利用する。
【0028】
また、前記複数のノードは、それぞれ独立に処理を行い、前記決定された第2のノードは、前記決定された第1のノードからの分配されたデータを逐次入力し、入力されたデータごとに処理を行う。
【0029】
さらに、前記複数の第1のノードの各々は、該第1のノードで分配するデータをさらに並び替えるようにしてもよい。
【0030】
前記第3のノードは、前記決定された第1のノードにおける予想される処理時間の算出結果から、より先に処理が終了する第1のノードに対して分配処理後に当該第1のノードにおいて並び替えをするように決定することができる。
【0031】
前記第3のノードは、前記処理時間に基づいて決定した前記第2のノードの台数を、所定数増加させるように決定する。
【0032】
前記決定された第2のノードは、前記第1のノードにおける分配されたデータの並び替えの終了後にマージ処理をするようにしてもよい。
【0033】
前記第2のノードは、前記第1のノードにおける分配されたデータの並び替えの終了後にマージ処理を行い、該マージされたデータに基づいて問い合わせに対する突き合わせの処理を行う。
【0034】
前記第3のノードは、前記突き合わせの処理および前記問い合わせに対する結果の出力の処理における予想される処理時間を算出し、該算出結果に基づいて、前記出力の処理の処理時間が、前記突き合わせの処理処理の時間より大きい場合には、前記突き合わせの処理の中で前記マージ処理を行わせる。
【0035】
また、本発明の他の態様によれば、データベースを構成するデータを分散して格納する記憶手段を備え、指示されたときに、前記記憶手段に格納されたデータを取り出し、取り出したデータを他のノードに分配する複数の第1のノードと、指示されたときに、前記第1のノードにより分配されたデータを受け取り、受け取ったデータに対するデータベース演算を実行し、その結果を出力する複数の第2のノードと、ユーザからの問い合わせを受け付けて、該問い合わせを解析し、該解析結果に基づいて、前記複数の第1のノードのうち少なくとも一つの第1のノードに対して前記データの取りだしを指示し、前記第2のノードのうち少なくとも一つの第2のノードに対して前記データベース演算の実行を指示し、当該第2のノードから出力された演算結果を受け取り、前記問い合わせに対する結果を出力する第3のノードとを有し、前記第3のノードは、受け付けた問い合わせの解析結果に基づいて、前記データの取りだしを指示する第1のノードを決定し、当該第1のノードにおける予想される処理時間を算出し、実行する第2のノードの数に対する予想される処理時間を算出し、前記第1のノードにおける予想される処理時間と、前記実行する第2のノードの数に対する予想される処理時間とに基づいて前記データベース演算の実行を指示する第2のノードの数を決定することができる。
【0036】
【作用】
前記決定管理ノードは、前記解析手段の問い合わせの解析結果に基づいて前記分配ノードを決定し、前記分配ノードにおける予想される処理時間を算出し、該処理時間に基づいて結合ノードを決定する。決定手段は、前記決定された分配ノードにおける予想される取り出し情報量に基づいて、前記結合ノードへの前記取り出し情報の分配を前記各結合ノードに均等に割当てるようにする。
【0037】
前記決定された分配ノードのそれぞれは、前記問い合わせの解析結果に基づいて前記記憶手段から情報を取り出して該取り出した情報を他のノードに分配する。分配ノードおよび結合ノードは、それぞれ独立に処理を行い、前記結合ノードは、前記分配ノードからの分配された情報を逐次入力し、入力された情報ごとに処理を行う。前記決定された結合ノードのそれぞれは、前記分配ノードから分配された情報を並び替え、該並び替えられた情報が複数ある場合にはそれらをマージし、該マージされた情報に基づいて問い合わせに対する突き合わせをし、前記結合ノードから得られた、問い合わせに対する結果を出力する。
【0038】
また、決定手段は、前記分配ノードにおける予想される処理時間の算出結果から、より先に処理が終了する分配ノードに対して分配処理後に前記分配ノードの並び替え手段において並び替えをするように決定する。決定された分配ノードの並び替え手段は、該分配ノードで分配する情報を並び替える。
【0039】
さらに、決定手段は、前記突き合わせ手段および前記出力手段における予想される処理時間を算出し、該算出結果に基づいて、前記出力手段の処理時間が、前記突き合わせ手段の処理時間より大きい場合には、前記突き合わせ手段に前記マージ処理を行わせるように決定する。決定された突き合わせ手段は、マージ処理をする。
【0040】
また、処理時間があらかじめ定まっているときに、該処理時間以内で処理をさせるために、前記決定手段は、分配ノードにおける予想される処理時間に基づいて決定した前記結合ノードの台数を、所定数増加させるように決定する。これにより、結合ノードの台数が増加し、結合ノードの並び替え手段は、並び替え処理が短時間で処理できるので、並び替え処理の終了後にマージ処理をする。
【0041】
本発明の問合せ処理方法によれば、各ノードで実行するデータベース演算に対応して各ノード数を決定できる。また、データの分割にバラツキが存在する場合、各ノードへデータを均等に分割させ、各ノードで実行する各データベース演算をパラメタ化し期待する処理時間均等化させるので、各ノード間で処理時間の偏りがなく、円滑にパイプライン動作させることが可能である。
【0042】
また、本発明の他の構成によれば、第3のノードは、ユーザからの問い合わせを受け付けて、該問い合わせを解析し、該解析結果に基づいて、前記複数の第1のノードのうち少なくとも一つの第1のノードに対して前記データの取りだしを指示し、前記第2のノードのうち少なくとも一つの第2のノードに対して前記データベース演算の実行を指示する。第3のノードは、前記決定された第1のノードにおける、予想される取り出しデータ量に基づいて、前記決定された第2のノードへの前記取り出しデータの分配を当該決定された第2のノードに均等に割当てるようにする。
【0043】
決定された第1のノードの各々は、指示されたときに、前記記憶手段に格納されたデータを取り出し、取り出したデータを他のノードに分配すべく前記ネットワークに送出する。第1のノード及び第2のノードは、それぞれ独立に処理を行い、決定された第2のノードは、前記決定された第1のノードからの分配されたデータを逐次入力し、入力されたデータごとに処理を行う。決定された第2のノードの各々は、指示されたときに、前記ネットワークに送出されたデータを受け取り、受け取ったデータに対するデータベース演算を実行し、その結果を前記ネットワークに送出する。第3のノードは、前記ネットワーク上に送出された演算結果を受け取り、前記問い合わせに対する結果を出力する。
【0044】
また、第3のノードは、前記決定された第1のノードにおける予想される処理時間の算出結果から、より先に処理が終了する第1のノードに対して分配処理後に当該第1のノードにおいてデータを並び替えるように決定する。決定された第1のノードは、分配処理後にデータを並び替える。
【0045】
さらに、第3のノードは、前記突き合わせの処理および前記問い合わせに対する結果の出力の処理における予想される処理時間を算出し、該算出結果に基づいて、前記出力の処理の処理時間が、前記突き合わせの処理処理の時間より大きい場合には、前記突き合わせの処理の中で前記マージ処理を行わせる。
【0046】
また、処理時間が予め定まっているときに、該処理時間以内で処理をさせるために第3のノードは、前記処理時間に基づいて決定した前記第2のノードの台数を、所定数増加させるように決定する。これにより、第2のノードの台数が増加し、並び替えの処理をより短時間で処理することができる。並び替え処理の終了後にはマージ処理をすることができる。
【0047】
本発明によれば、データを取りだして分配するノードとデータベース演算を実行するノードとを決定できる。また、データの分割にバラツキが存在する場合、各ノードへデータを均等に分割させ、各ノードで実行する各データベース演算をパラメタ化し、期待する処理時間を均等化させるので、各ノード間で処理時間の偏りがなく、円滑にパイプライン動作をさせることが可能である。
【0048】
【実施例】
以下、本発明の実施例を図面に基づいて詳細に説明する。
【0049】
図2は、本実施例のデ−タベ−スシステムの概念図を示している。図2において、デ−タベ−スシステムは、ユ−ザが作成した、複数のアプリケ−ションプログラム(以下、APと略記する)10および11と、問合せ処理やリソ−ス管理等デ−タベ−スシステム全体の管理を行うDBMS20と、デ−タベ−ス処理において、入出力処理対象となるデ−タの読書きを行い、計算機システム全体の管理を受け持つオペレ−ティングシステム(以下では、オペレ−ティングシステムをOSと略記する)30と、デ−タベ−ス処理対象となるデ−タを格納するデ−タベ−ス40と、データベースの定義情報を管理するディクショナリ50とを有する。DBMS20は、他のデータベース管理システムと接続されている。ディクショナリ50には、本実施例において使用する結合カラムに関する最適化情報なども記憶されている。
【0050】
上記DBMS20は、システム全体の管理、制御に加えて、入出力の管理等を行うシステム制御部21と、問い合わせに関する論理処理を行う論理処理部22と、データベースの物理処理を実行する物理処理部23と、当DBMS20で処理対象となるデータを格納するデータベースバッファ24とを備える。また、論理処理部22は、問合せの構文解析、意味解析を行う問合せ解析220、適切な処理手順を生成する静的最適化処理221、処理手順に対応したコ−ドの生成を行なうコード生成222、静的最適化処理221で生成された処理手順候補から最適なものを選択する動的最適化処理223、および、当コードの解釈実行を行うコード解釈実行部224を備える。また、物理処理部23は、アクセスしたデ−タの条件判定、編集、レコード追加等を実現するデ−タアクセス処理230、データベースレコ−ドの読み書きを制御するデ−タベ−スバッファ制御231、入出力対象となるデ−タの格納位置を管理するマッピング処理232、および、システムで共用するリソースの排他制御を実現する排他制御233を備える。
【0051】
図3は、本発明が適用されるハードウェア構成の一例を示すものである。具体的には、図3は、プロセッサおよびディスク装置が1ノードを構成し、複数のノードを備える並列プロセッサシステムの適用構成例を示している。図3において、プロセッサ60〜65およびディスク装置70〜75が相互結合ネットワーク80で接続される。図3に示すハードウェア構成は、図2に示すデータベースシステムを複数のプロセッサで並列処理するための構成であり、各ノードに対してそれぞれ処理が分散される。
【0052】
上記各ノードごとに機能分散した場合の構成を図1に示す。図1は、本実施例が適用されたデ−タベ−スシステムの概要図を示している。以下に、並列データベースシステムの処理例を図1を参照して説明する。この例では、データベースに対する検索要求に並列処理を適用する。図1において、各ノードは、データを取り出して分配処理するソート機能と、複数のノードでそれぞれソートされたデータを結合処理するマージ機能とが各ノードごとに割り当てられている。ノードによりソート機能だけを備えるものや、ソート機能とマージ機能とを備えるものがある。デ−タベ−スは、ユ−ザから2次元のテ−ブル形式で見られる表から成るものとし、当該表は行あるいはロウごとにデータが存在するものである。また、ロウは、1つ以上の属性(これを「カラム」という)からなる。図1においては、データベースの表としてT1およびT2があり、ノード1(90)からノード4(91)に表T1が、ノード5(92)からノード8(93)に表T2が各々格納されており、これらの各ノードが分配ノードであり、分配ノードにおいて格納している表に基づいてデータ取り出し処理およびデータ分配処理が実行される。また、ノード9(94)からノード11(96)は、結合ノードであり、ノード1〜4およびノード5〜8から出力されるデータを受け取り、部分列ソート処理およびマージ処理をして完全列の作成を実行する。さらに、ノード12(97)は、問い合わせを受け付け、該問い合わせを解析し、問い合わせに対する処理を実行する分配ノードおよび結合ノードの数を決定する決定ノードである。また、ノード12(97)は、ノード9〜11から出力されたデータを受け取り出力する。これらのノード群は、相互結合ネットワーク80で接続され、ノード1〜4およびノード5〜8と、ノード9〜11とが並列に動作し、しかもノード1〜4およびノード5〜8でそれぞれ処理された結果は、すぐにノード9〜11で処理を行うというようなパイプライン的に動作する(以下、並列パイプライン動作と呼ぶ)。また、ノード9〜11とノード12とも同様にパイプライン動作する。以下では、ノード9〜11における部分列ソート処理をスロットソート処理といい、完全列作成処理をNウェイマージ処理と呼ぶ。スロットソート処理は、データが格納されるページを対象とするページ内のソート処理を指し、スロット順に読みだせば昇順にロウがアクセス可能とする。Nウェイマージ処理は、Nウェイのバッファを用いて、各マージ段でN本のソート連を入力にして最終的に1本のソート連を作成する。
【0053】
データベース検索処理のための問合せは、例えば、以下のようになる。
【0054】
SELECT T1.C3,T2.C3
FROM T1,T2
WHERE T1.C1=T2.C1
AND T1.C2=?
このような問い合わせが、ノード12において受け付けられると、ノード12において、最適な分配処理方法が選択され、各ノードに対してネットワークを介して指示される。上記の問い合わせにおいては、ノード1(90)からノード4(91)に表T1が、ノード5(92)からノード8(93)に表T2が各々格納されているので、各ノードにおいてデータ取り出し処理およびデータ分配処理が実行される。また、ノード9(94)からノード11(96)では、ノード1〜4およびノード5〜8から出力されるデータを逐次受け取り、ソート処理および結合処理を実行する。ノード12(97)では、ノード9〜11から出力されたデータを受け取り出力する。これによりデータベース検索は終了する。
【0055】
つぎに、上記各ノードの処理時間の関係について図4を参照して説明する。図4は、並列パイプライン動作を説明するための概要図を示す。図4において、100および101は、図1におけるノード1(90)からノード4(91)と、ノード5(92)からノード8(93)とにおける処理に対応し、データ取り出し処理およびデータ配分処理を実行する。110および111は、ノード9(94)からノード11(96)における処理に対応し、スロットソート処理、Nウェイマージ処理、突き合わせ処理が実行される。120は、ノード12(97)における処理に対応し、要求データ出力処理が実行される。時間軸に沿えば、データ取り出し処理およびデータ配分処理100および101で処理されたデータは、逐次スロットソート処理110および111に移り、パイプライン的に実行される。データ取り出し処理からスロットソート処理までを取り出しフェーズと呼ぶ。また、Nウェイマージ処理110および111は、それぞれのノードで単に並列に実行される。このNウェイマージ処理期間をマージフェーズと呼ぶ。さらに、突き合わせ処理の結果は要求データ出力処理120に逐次転送されてパイプライン的に実行される。この突き合わせから要求データ出力までを結合フェーズと呼ぶ。図4に示すタイムチャートは、図1に示す問合せ例を適用した場合の処理内容である。取り出しフェーズにおいて、ノード1(90)からノード4(91)における処理時間は、T1データ取り出し/データ分配処理時間130として示す。また、ノード5(92)からノード8(93)における処理時間は、T2データ取り出し/データ分配処理時間131で示し、相互結合ネットワーク80における転送時間をデータ分配転送時間140で示し、ノード9(94)からノード11(96)における処理時間は、T1/T2スロットソート処理時間150に示すように、各々実行される。図4において、取り出しフェーズは、スロットソート処理完了待ち合わせ180の時点までで終了する。また、マージフェーズにおいて、ノード9(94)からノード11(96)における処理時間は、T1/T2Nウェイマージ処理時間151に示す時間において実行される。このマージフェーズは、T1/T2Nウェイマージ処理待ち合わせ181までで終了する。結合フェーズは、ノード9(94)からノード11(96)における処理時間は、突き合わせ処理時間152で示し、相互結合ネットワーク80における処理時間は、結合結果転送時間160で示し、ノード12(97)における処理時間は、要求データ出力処理時間170で示し、各々その時間内に実行される。
【0056】
つぎに、図1におけるノード12の各ノード群への処理の振り分け方法について図5を参照して説明する。図5は、データ分配処理における各ノード群への振り分け方法を示す説明図である。前提として、データ取り出し/データ分配処理をするノード群は、プロセッサ200〜230とディスク装置201〜231とを備えるノード1〜10の10台からなる。また、結合処理をするノード群は、プロセッサ240〜250とディスク装置241〜251とを備えるノード11〜15の5台からなるとする。ディクショナリ50には、結合カラムに関する最適化情報51が格納されていている。該最適化情報51とは、データベースのデータを均等に分割するための情報であり、例えば、結合カラムに対するデータ件数は通常均一でないので、データ件数が均一になるように結合カラムで分割するようにするものである。図5に示すように、ノード1〜10に格納されているデータが、v1からv10の各分割範囲で均等にデータ分割可能であることを示す。この場合、ノード11〜15に均等にデータ分割するためにはv1〜v2、v3〜v4、v5〜v6、v7〜v8、v9〜v10の5区間にそれぞれノード番号11、12、13、14、15を対応付けるような分配処理手段を備えればよい。上記最適化情報が存在しない場合、適当なハッシュ関数を設定してデータ分配を行なえばよい。このようにして、図1におけるノード12では、分配処理手段を備えることにより、Nウェイマージ処理を行う際の各ノード群への処理の振り分けを行う。これにより、上記のような場合には、ノード11〜15に均等にデータ分割することができ、処理時間が均等になる。
【0057】
つぎに、Nウェイマージ処理を行う際の結合ノード数の決定方法について図6を参照して説明する。図6は、結合ノード数決定方法を説明するための概要図を示している。
【0058】
図1における並列結合処理の各フェーズ、各処理の処理時間をグラフ化し、図4に示す並列パイプライン動作概要に合わせてレイアウトしている。図6において、データ取り出し/データ分配処理が、ノード1〜8で実行され、300〜305の処理時間がそれぞれかかるものとする。ここでは、ノード5の処理時間304が最大処理時間であるとする。スロットソート処理時間は、結合処理ノード数Nと、予め決められたシステム特性(CPU性能、ディスク装置性能等)と、データベース演算方法とから導けることができ、スロットソート処理の性能特性は一般的に下記に示すような式で求めることができる。
【0059】
【数1】
E=a/N+b*N+c
パイプライン処理を行う際の効果を最大にするために、スロットソート処理の性能特性と最大処理時間304との交点となる結合ノード割当て数350をノード数として求めることができる。結合ノード割当て数350が決まると、Nウェイマージ処理時間320および突き合わせ処理時間330が、Nウェイマージ処理の性能特性と突き合わせ処理の性能特性とから同様に推定できる。これらの処理時間の合計が問い合わせに対する全体の処理時間となる。このように結合ノード数を決定し、データ取り出し/データ分配処理において分配されたデータを逐次マージして同時に処理することにより、全体の処理時間(問い合わせをしてから出力されるまでの応答時間)を短縮することができる。
【0060】
結合ノード数を決定する場合に用いられる性能特性の具体例を以下に示しておく。例えば、ロウ数が表T1および表T2とも10、000、000件あり、条件数がT1−1コ(全体ロウが1%に絞られる)とし、データ取り出し/データ分配処理をする分配ノード数が表T1および表T2ともそれぞれ16ノードで均等分割され、結合ノード数が8ノードで、プロセッサ性能が50MIPS(1秒間に5千万命令実行)で、ネットワーク転送レートが20Mバイト/秒であるとする。このような条件で実際のデータベース管理システムに処理させた結果もしくは性能モデルから算出した結果が以下のようになる。
【0061】
表T1および表T2の分配ノードの処理時間がそれぞれ180秒、T1/T2スロットソート処理時間が80秒、Nウェイマージ処理時間が380秒、突き合わせ処理時間が110秒、要求データ出力時間が10秒となる。これらの結果の処理性能に基づいて問い合わせに対する処理時間を推定する。
【0062】
つぎに、図6に示した結合ノード数決定方法を基にして、応答時間をさらに短縮するための処理時間調整方法(チューニング方法)について、図7、図8および図9を参照して説明する。以下に示す方法は、上記ノード12の分配処理手段において、各ノード群への処理の振り分けを決定する際にあらかじめ算出されて、その結果より振り分けを決定するものである。
【0063】
図7は、スロットソート前処理化の概要図を示す。データ取り出し/データ分配処理が、ノード1〜8で実行され、各300〜305の処理時間がそれぞれかかるものとする。ノードごとの処理時間には各表のデータ数によりバラツキが存在する。また、スロットソート処理は、結合処理ノード群で実行されるように設定されている。ノードごとの処理時間でバラツキがある場合には、データ取り出し/データ分配処理ノード群へスロットソート処理を移す処理手順を考える。図7に、スロットソートの前処理化として示すように、データ取り出し/データ分配処理がより早く終了したノードでスロットソート処理を行う。その処理によれば、結合ノード割当て数350のノードにおけるスロットソート処理時間が310から312に削減できる。その処理時間の差311においてNウェイマージ処理を移す。これは、スロットソート処理の連長を延ばすことにほかならない。これによって、Nウェイマージ処理時間が削減でき、結果的に応答時間が削減できる。
【0064】
図8は、スロットソート連長チューニング概要図を示している。例えば処理時間の制約があったときなどのように、その時間内で複数の処理を行う場合において、各ノードで実行する各データベース演算をパラメータ化し、期待する処理時間に基づいて時間調整(チューニング)をする方法について説明する。図6で求まる結合ノード割当て数350から最小限だけ結合処理ノードを増やし、応答時間の短縮を図る。この場合の結合ノード割当て数を351とする。結合ノード割当て数351とすると、スロットソート処理時間は310から312へ削減される。パイプライン効果を最大にするため、処理時間311においてNウェイマージ処理をスロットソート処理へ移す。これによって、Nウェイマージ処理のマージ回数が減り、処理時間が320と削減でき、結果的に応答時間が削減できる。
【0065】
図9は、Nウェイマージ回数チューニングの概要図を示す。結合ノード割当て数350で決まる突き合わせ処理時間330が要求データ出力処理時間340より小である場合には、Nウェイマージ処理の最終段のマージ処理を突き合わせ処理に移すようにできる。Nウェイマージ処理の最終段のマージ処理時間331と突き合わせ処理時間330との和が要求データ出力処理時間340を上回らなければ、当最終段のマージ処理を突き合わせ処理へ移す。これによって、応答時間が削減できる。
【0066】
つぎに、本実施例におけるデータベース管理システムの動作フローを説明する。図10、図11、図12、図13、図14および図15は、本実施例におけるDBMSの処理のフロ−チャ−トを示す。図10において、DBMSは、問合せ実行前に行われる問合せの解析処理(ステップ220)、静的最適化処理(ステップ221)およびコード生成(ステップ222)により問い合わせ解析を行う問合せ解析処理400と、変数に定数を代入し、処理手順を選択する動的最適化処理(ステップ223)および問合せのコード解釈実行(ステップ224)により問い合わせに対する実行処理を行う問合せ実行処理410とを行う。
【0067】
以下、各処理部の概要について述べる。
【0068】
(a)問合せ解析処理400
図10(a)および(c)において、問合せ解析(ステップ220)では、上記ノード12においてアプリケーションプログラムにより入力された問合せ文の構文解析、意味解析を実行する(ステップ2200)。図10(a)において静的最適化処理(ステップ221)では、上記ノード12において問合せで出現する条件式から条件を満足するデ−タの割合を推定し、予め設定している規則を基に、有効なアクセスパス候補(特にインデクスを選出する)を作成し、処理手順の候補を作成する。コード生成(ステップ222)では、上記ノード12において処理手順候補を実行形式に展開する。
【0069】
(b)問合せ実行処理410
図10(b)において、動的実行時最適化(ステップ223)では、上記ノード12において代入された定数に基づき、各ノード群で実行する処理手順を決定する。コード解釈実行(ステップ224)では、それぞれのノードにおいて処理手順を解釈し、実行する。
【0070】
つぎに、各処理部の詳細な処理フローの説明を行う。
【0071】
図10(d)において、動的最適化処理(ステップ221)では、問合せに出現する条件式の述語選択率推定し(ステップ2210)、インデクス等からなるアクセスパスの剪定をし(ステップ2211)、これらアクセスパスを組合せた処理手順候補の生成をする(ステップ2212)。
【0072】
図10(e)において、述語選択率推定(ステップ2210)では、問合せ条件式に変数が出現するか否かチェックする(ステップ22101)。変数が出現すれば、当条件式にカラム値分布情報があるかチェックする(ステップ22104)。存在すれば終了する。存在しなければ、条件式の種別に応じてディフォルト値を設定し(ステップ22105)、終了する。変数が出現しなければ、当条件式にカラム値分布情報があるかチェックする(ステップ22104)。存在しなければ、条件式の種別に応じてディフォルト値を設定し(ステップ22105)、終了する。存在すれば、カラム値分布情報を用いて選択率を算出する(ステップ22103)。
【0073】
図11において、アクセスパス剪定2212では、問合せ条件式で出現するカラムのインデクスをアクセスパス候補として登録する(ステップ22120)。つぎに、問合せでアクセス対象となる表が複数ノードに分割格納されているかチェックする(ステップ22121)。分割格納されていれば、パラレルテーブルスキャンをアクセスパス候補として登録する(ステップ22123)。分割格納されていなければ、テ−ブルスキャンをアクセスパス候補として登録する(ステップ22123)。各条件式の選択率が既に設定済みか否かチェックする(ステップ22124)。設定済みであれば、各表に関して選択率が最小となる条件式のインデクスをアクセスパスの最優先度とする(ステップ22125)。設定済みでなければ、各条件式の選択率の最大値/最小値を取得する(ステップ22126)。最後に、CPU性能、IO性能等のシステム特性より各アクセスパスの選択基準を算出し(ステップ22127)、単一あるいは複数のインデクスを組合せたアクセスパスでの選択率が上記選択基準を下回るものだけアクセスパス候補として登録する(ステップ22128)。
【0074】
図12において、処理手順候補生成2213は、問合せでアクセス対象となる表が複数ノードに分割格納されているかチェックする(ステップ22130)。分割格納されていれば、ステップ22135へ移行する。分割格納されていなければ、処理手順候補にソート処理が含まれているか否かをチェックする(ステップ22131)。含まれていれば、ステップ22135へ移行する。含まれていなければ、問合せでアクセス対象となる表のアクセスパスが唯一であるかチェックし(ステップ22132)、唯一であれば単一の処理手順を作成し(ステップ22133)、唯一でなければ複数の処理手順を作成し(ステップ22134)、終了する。ステップ22135では、結合可能な2ウェイ結合へ問合せを分解する。分割格納される表の格納ノード群に対応して、データ読みだし/データ分配処理手順を候補として登録する。また、スロットソート処理手順を候補として登録する(ステップ22136)。結合処理ノード群に対応して、スロットソート処理手順、Nウェイマージ処理手順および突き合わせ処理手順を候補として登録し、スロットソート連長およびマージ処理回数をパラメタ化しておく(ステップ22137)。要求データ出力ノードに要求データ出力処理手順を登録する(ステップ22138)。最後に、分解結果に対して評価がすべて終了すれば(ステップ22139)、終了する。
【0075】
図13において、コード生成222は、処理手順候補が唯一か否かをチェックする(ステップ2220)。唯一であれば、ステップ2223へ移行する。唯一でなければ、カラム値分布情報等からなる最適化情報を処理手順に埋込み(ステップ2221)、問合せ実行時に代入された定数に基づいて処理手順を選択するデータ構造を作成する(ステップ2222)。最後に、処理手順を実行形式へ展開する(ステップ2223)。
【0076】
図14において、動的最適化処理223は、作成されている処理手順が単一か否かをチェックする(ステップ22300)。単一であれば、終了する。単一でなければ、代入された定数を基に選択率を算出する(ステップ22301)。処理手順候補に並列な処理手順が含まれるか否かチェックする(ステップ22302)。含まれていなければ、アクセスパスの選択基準に従って処理手順を選択し(ステップ22313)、終了する。含まれていれば、ディクショナリから最適化情報(結合カラムのカラム値分布情報、アクセス対象となる表のロウ数、ページ数等)を入力し(ステップ22303)、データ取り出し/データ分配のための処理時間を各システム特性を考慮し、前述したように算出する(ステップ22304)。当処理時間から結合処理に割当てるノード数pを決定し、当処理手順a1を決定する(ステップ22305)。データ取り出し/データ分配処理時間にバラツキがあるか否かをチェックする(ステップ22306)。バラツキがあれば、データ取り出し/データ分配処理ノード群でスロットソート処理を実行する処理手順a2を設定する(ステップ22307)。つぎに、結合ノード割当て数pをα台だけ増した処理手順a3を設定する(ステップ22308)。要求データ処理時間が突き合わせ処理時間と1回分のNウェイマージ処理時間との和より大であれば(ステップ22309)、突き合わせ処理へ1回分のNウェイマージ処理を移した処理手順a4を設定する(ステップ22310)。処理手順a1〜a4で最適な処理手順を応答時間最小、各ノード負荷量最小、他トランザクション応答性能への影響小等の観点で選択する(ステップ22311)。データ分配情報を最適化情報を基にして作成する(ステップ22312)。最適化情報がなければ、ハッシュ関数の結合カラム評価値に従い、データ分配情報を作成する。アクセスパスの選択基準に従って処理手順を選択し(ステップ22313)、終了する。
【0077】
図15において、コード解釈実行処理224では、設定された各ノードにおいてそれぞれ対応する処理手順にしたがって処理を行う。
【0078】
まず、各ノードでは、データ取り出し/データ分配処理が設定されているか否かを判断する(ステップ22400)。データ取り出し/データ分配処理が設定されていれば、各ノードの記憶装置に格納されているデータベースにアクセスし、条件式を評価する(ステップ22401)。最適化情報を基に作成されたデータ分配情報に基づいて、データを取り出し、各結合ノードのバッファへ逐次データを分配する(ステップ22402)。各結合ノードのバッファが満杯か否かを判定し、満杯であれば、ページ形式で対応する結合ノードへ転送する。問い合わせに対応する全てのデータを取り出して分配すると処理が終了する(ステップ22404)。
【0079】
また、各ノードでは、スロットソート処理が設定されているか否かを判断する(ステップ22405)。スロットソート処理が設定されていれば、前記データ取り出し/データ分配処理ノードからのページ形式のデータを受信し、(ステップ22406)受信したデータについて順次スロットソート処理を行う(ステップ22407)。処理したスロットソート結果を一時保存しておき、スロットソート処理を終了する(ステップ22408)。
【0080】
また、Nウェイマージ処理が設定されているか否かを判断する(ステップ22409)。Nウェイマージ処理が設定されていれば、スロットソート結果に基づいてNウェイマージ処理を実行し(ステップ22410)、Nウェイマージ処理結果をバッファなどに一時保存し(ステップ22411)、Nウェイマージ処理を終了する。
【0081】
また、突き合わせ処理が設定されているか否かを判断する(ステップ22412)。突き合わせ処理が設定されていれば、Nウェイマージ処理結果のソートリストを突き合わせ、出力用バッファにデータを設定する(ステップ22413)。出力用バッファが満杯の場合には、ページ形式で要求データ出力ノードへ転送する(ステップ22415)。
【0082】
また、要求データ出力処理が設定されているか否かを判断する(ステップ22416)。要求データ出力処理が設定されていれば、結合ノードからページ形式のデータの転送があるかないかを判断する(ステップ22417)。ページ形式のデータの転送がある場合には、該ページ形式のデータを受信し(ステップ22418)、アプリケーションプログラムへ問い合わせ処理結果を出力し、ページ形式のデータ転送がない場合にはそのまま問い合わせ処理結果を出力する(ステップ22419)。
【0083】
また、上記コード解釈実行処理において、処理時間にバラツキがある場合などのときにデータ取り出し/データ分配処理ノード群でスロットソート処理を実行する場合には、データ取り出し/データ分配処理終了後、コード解釈実行処理224を再度実行し、スロットソート処理を行うようにする。
【0084】
さらに、ステップ22413でNウェイマージ処理結果が完全ソート列でなければ、最終段のマージと突き合わせ処理とを行う。
【0085】
以上のように処理することによりデータベース管理システムの問い合わせ応答時間を短縮することができる。
【0086】
図6に示す結合ノード割当て方法と、図7、図8および図9に示すチューニング方法とは、各々独立に適用してもよいし、また任意の組合せで適用してもよい。すなわち、動的最適化処理223では、すべての組合せが適用できる場合を想定している。さらに、データ取り出し処理においては、複数ディスク装置からなる並列入出力アクセス方法の適用と、一括入出力方法/先読み入出力方法の適用と、データ分配処理に最適化情報あるいはハッシュ関数によるデータ分配方法の適用と、Nウェイマージ処理に並列ソート方法の適用と、突き合わせ処理にノード間での突き合わせ処理方法の適用と、要求データ出力処理に複数のノードを割当て並列受け取り処理方法の適用等も考えられる。上記ステップ22309およびステップ22310では、1回分のNウェイマージ処理を仮定しているが、一般的にn回(n≧1)としてもよい。
【0087】
図4に示す並列パイプライン動作に関して、上記図6に示した結合ノード割当て方法と、図7、図8および図9に示すチューニング方法とを適用すると、取り出しフェーズ、マージフェーズ、結合フェーズの内、マージフェーズが省略可能となる場合も存在する。すなわち、スロットソート連長の延び、Nウェイマージ処理の移動により可能となる。この場合、問合せ実行処理でもマージフェーズの処理を省略する。
【0088】
本発明の問合せ処理方法は、統計情報を用いた規則とコスト評価との併用に限らず、適当なデ−タベ−ス参照特性情報を与える処理手順が得られるものであれば適用できる。例えば、コスト評価のみ、規則利用のみ、コスト評価と規則利用の併用等の最適化処理を行うDBMSにも適用できる。
【0089】
本発明は、密結合/疎結合マルチプロセッサシステム大型計算機のソフトウェアシステムを介して実現することも、また、各処理部のために専用プロセッサが用意された密結合/疎結合複合プロセッサシステムを介して実現することも可能である。また、単一プロセッサシステムでも、各処理手順のために並列なプロセスを割当てていれば、適用可能である。
【0090】
本実施例によれば、各ノードで実行するデータベース演算に対応して各ノード数を決定し、また、データの分割にバラツキが存在する場合、各ノードへデータを均等に分割させ、各ノードで実行する各データベース演算をパラメタ化し、期待する処理時間均等化させるので、各ノード間で処理時間の偏りがなく、円滑にパイプライン動作させることが可能となり、高速な問合せ処理が実現可能となる。
【0091】
【発明の効果】
各ノードで実行するデータベース演算に対応して各ノード数を決定し、各ノードへデータを均等に分割させ、各ノードで実行する処理時間均等化させるので、各ノード間で処理時間の偏りがなく、高速化な問合せ処理を実現することができる。
【図面の簡単な説明】
【図1】 並列結合処理概要図
【図2】 データベースシステムの構成図
【図3】 ハードウェア構成図
【図4】 並列パイプライン動作の概要図
【図5】 データ分配処理概要図
【図6】 結合ノード割当て概要図
【図7】 スロットソート前処理化概要図
【図8】 スロットソート連長チューニング概要図
【図9】 Nウェイマージ回数チューニング概要図
【図10】 データベース管理システムのフローチャート
【図11】 データベース管理システムのフローチャート
【図12】 データベース管理システムのフローチャート
【図13】 データベース管理システムのフローチャート
【図14】 データベース管理システムのフローチャート
【図15】 データベース管理システムのフローチャート
【符号の説明】
10、11…アプリケーションプログラム、20…データベース管理システム、22…論理処理部、220…問合せ解析、221…静的最適化処理、222…コード生成、223…動的最適化処理、224…コード解釈実行、30…オペレーティングシステム、40…データベース、50…ディクショナリ、80…相互結合ネットワーク、90、91、92、93、94、95、96、97…ノード。
[0001]
[Industrial application fields]
The present invention relates to a database processing apparatus, and more particularly to a query processing method suitable for parallel processing of queries suitable for a relational database management system.
[0002]
[Prior art]
A database management system (hereinafter abbreviated as DBMS), in particular, a relational DBMS processes a query expressed in a non-procedural language, determines an internal processing procedure, and executes it according to the internal processing procedure. SQL is used as this database language (Database Language SQL ISO 9075: 1989). The main methods of conventional query processing include determining a single internal processing procedure based on preset rules and a plurality of candidate processing procedures selected using various statistical information, by cost evaluation, Some determine what seems to be optimal. In the former case, although the load for creating the processing procedure is small, there is a problem in the validity of the uniformly set rule, and there is also a problem in the optimality of the selected internal processing procedure. The latter manages various statistical information, creates a plurality of candidate processing procedures, calculates a load for cost evaluation thereof, and gives an optimal processing procedure. As a combination technique of the above, there is, for example, Satoh, K., et.al. “Local and Global Optimization Mechanisms for Relational Database”, Proc. VLDB, 1985. In the prior art, the processing procedure is determined by estimating the amount of data from the inquiry conditions.
[0003]
In addition, in many DBMSs, query processing is realized through two-phase processing of query analysis processing and query execution processing. When a query language is incorporated into a host language (COBOL, PL / I, etc.), the query is subjected to query analysis processing in advance before executing the application program, and one internal processing procedure that is an execution format is created. In this query expression, a host language variable is often described in the search condition expression. A constant is assigned to this variable when an internal processing procedure that has already been subjected to a query analysis process is executed, that is, when a query is executed. The problem in this case is that a plurality of optimum processing procedures can be considered according to the value substituted for the variable. In order to solve this problem, there is a method in which a plurality of processing procedures are created at the time of executing a query, and the processing procedure is selected according to a value assigned to a variable at the time of executing the query. Regarding the code technology, there are technologies described in Japanese Patent Application Laid-Open No. 1-194028 and Graefe, G., et.al. “Dynamic Query Evaluation Plans”, Proc. ACM-SIGMOD, 1989. .
[0004]
Furthermore, it is desired by users to provide a scalable parallel database system in response to an increase in transaction volume and an increase in database volume that exceed the increase in CPU performance and disk capacity. User performance requirements for a database system include support for tens of thousands of concurrent users, the appearance of terabyte-based search transactions, and guaranteed response times that are not proportional to the table size. Parallel database systems are attracting attention, coupled with recent reductions in hardware costs. Regarding the parallel database system, there is a technique described in DeWitt, D., et.al .: “Parallel Database Systems: The Future of High Performance Database Systems”, CACM, Vol. 35, No. 6, 1992. In such a system, it is necessary to connect a processor in a tightly coupled or loosely coupled manner, and to allocate and schedule database processing to a plurality of processors statically / dynamically. If the degree of parallelism is increased, the response performance is improved. However, an excessive degree of parallelism is adversely affected by an increase in overhead and an increase in the response time of other transactions. Therefore, setting an appropriate degree of parallelism is important.
[0005]
In the database processing, the data to be processed exists on the secondary storage device, and it is necessary to read and transfer a large amount of data for each database operation. Even in a parallel database system, when a large amount of data is transferred, the data transfer time becomes a performance bottleneck of the database system. Therefore, a method of effectively utilizing the time for transferring data from the secondary storage device can be considered. This overlaps the data transfer time and the time required for the database processing for the data, and is well known in the prior art. This method can also be applied to data transfer between processor groups connected by an interconnection network.
[0006]
[Problems to be solved by the invention]
In the above prior art, the query optimization process is one in which the DBMS automatically determines the most efficient processing procedure based on various statistical information of the database system from the query input by the user. Furthermore, when a variable is embedded in the query selection conditional expression, multiple processing steps are expanded at the time of query analysis, and by selecting the processing procedure according to the value assigned to this variable at the time of query execution, The optimal processing procedure is selected.
[0007]
In parallel database processing, database operations are divided into nodes (a processor or a pair of a processor and a disk device), and each database operation operates in parallel or in a pipeline manner at each node. According to the above prior art, a method for selecting a processing procedure at each node can be applied even in this parallel processing mode.
[0008]
However, in processing that operates in parallel, each node performs parallel processing at the same time, but there is a problem that the number of nodes cannot be determined in accordance with the database operation executed at each node. That is, since the criterion for determining the number of nodes is not clear, excessive parallelization has an adverse effect such as an increase in overhead, and it is difficult to optimally distribute the load.
[0009]
Further, in the process of performing the pipeline operation, the database operation is divided and stored in each node. However, when there is variation in the data division, the equal division method to each node is not clear.
[0010]
Furthermore, when multiple processes are performed within the time, such as when there is a restriction on the processing time, each database operation executed on each node is parameterized, and time adjustment (tuning) is performed based on the expected processing time. ) Is not clear.
[0011]
An object of the present invention is to provide a query processing method and a database system that speed up query processing.
[0012]
[Means for Solving the Problems]
In order to solve the above problems, the present invention comprises a plurality of nodes that execute database processing, and the plurality of nodes are database management systems connected to other nodes via a network, Storage means for distributing and storing a database, a distribution node including distribution means for extracting information from the storage means and distributing the information extracted to other nodes, and rearrangement for rearranging information distributed from the distribution node A combination node comprising: means; a merge means for merging the rearranged information when there are a plurality of rearranged information; and a matching node for performing a match on the query based on the merged information; and accepting the query Analyzing means for analyzing the inquiry and creating a processing procedure for the inquiry; and the analyzing means Comprising a determining means for determining a distribution node and join node performing the execution process based on the analysis result of the inquiry, said obtained from join node, and a decision management node and output means for outputting the result to the inquiry.
[0013]
The determination unit can determine the distribution node based on an analysis result of the query of the analysis unit, calculate an expected processing time in the distribution node, and determine a coupling node based on the processing time. .
[0014]
The determination means allocates the distribution of the extraction information to the combination nodes equally to the combination nodes based on the expected extraction information amount at the distribution node determined.
[0015]
The decision management node may comprise storage means for storing optimization information related to information in the storage means of each node, so that the decision means assigns extracted information evenly to the combined nodes.
[0016]
The decision management node uses a predetermined hash function in order for the decision means to assign the extracted information evenly to the combined nodes.
[0017]
The plurality of nodes perform processing independently, and the joining node sequentially inputs distributed information from the distribution node, and performs processing for each input information.
[0018]
Furthermore, the distribution node may include a rearranging unit that rearranges information distributed by the distribution node.
[0019]
The determination means determines, based on the calculation result of the expected processing time in the distribution node, that the distribution node rearranges the distribution node for which processing ends earlier to be rearranged by the distribution node rearrangement means. be able to.
[0020]
The determination unit determines to increase the number of the combined nodes determined based on the processing time by a predetermined number.
[0021]
The joining node rearranging means may have a function of performing a merge process after the rearrangement process ends. The matching unit may have a function of performing the merge process.
[0022]
The determining unit calculates an expected processing time in the matching unit and the output unit, and based on the calculation result, when the processing time of the output unit is larger than the processing time of the matching unit, It is determined to cause the matching unit to perform the merge process.
[0023]
In order to solve the above problems, the present invention is a database management system comprising a plurality of nodes connected to each other via a network, comprising storage means for distributing and storing data constituting the database. A plurality of first nodes for retrieving the data stored in the storage means when instructed, and sending the retrieved data to the network for distribution to other nodes; and when instructed, the network Receiving data sent to the network, executing database operations on the received data, receiving a query from the user and a plurality of second nodes sending the results to the network, analyzing the query, and analyzing the query Based on the result, the data for at least one first node of the plurality of first nodes is determined. Instructing at least one second node of the second nodes to execute the database operation, receiving the operation result transmitted on the network, and outputting the result of the inquiry And a third node.
[0024]
The third node determines, based on the analysis result of the received inquiry, a first node that instructs the data extraction, calculates an expected processing time in the first node, and calculates the processing time. The second node that instructs execution of the database operation can be determined based on the above.
[0025]
The third node determines the distribution of the retrieved data to the determined second node based on an expected amount of retrieved data at the determined first node. Allocate evenly to nodes.
[0026]
The third node may comprise storage means for storing optimization information relating to the data of the storage means of each node for equally assigning the fetched data to the determined second node.
[0027]
The third node uses a predetermined hash function in order to evenly assign extracted data to the determined second node.
[0028]
The plurality of nodes perform processing independently, and the determined second node sequentially inputs the distributed data from the determined first node, for each input data. Process.
[0029]
Furthermore, each of the plurality of first nodes may further rearrange data distributed by the first node.
[0030]
The third node is arranged in the first node after the distribution process with respect to the first node that ends processing earlier from the calculation result of the expected processing time in the determined first node. You can decide to change.
[0031]
The third node determines to increase the number of the second nodes determined based on the processing time by a predetermined number.
[0032]
The determined second node may perform a merge process after the rearrangement of the distributed data in the first node.
[0033]
The second node performs a merge process after the rearrangement of the distributed data in the first node, and performs a matching process for a query based on the merged data.
[0034]
The third node calculates an expected processing time in the matching process and a result output process for the query, and the output processing time is calculated based on the calculation result. If it is longer than the processing time, the merge process is performed in the matching process.
[0035]
Further, according to another aspect of the present invention, there is provided storage means for distributing and storing data constituting the database, and when instructed, the data stored in the storage means is taken out, and the taken out data is stored in other ways. A plurality of first nodes to be distributed to the nodes, and when instructed, receive the data distributed by the first node, perform database operations on the received data, and output the results 2 nodes and an inquiry from a user are received, the inquiry is analyzed, and the data is fetched from at least one of the plurality of first nodes based on the analysis result. Instructing at least one second node of the second nodes to execute the database operation, and outputting from the second node. A third node that receives the result of the operation and outputs the result for the query, the third node instructing the retrieval of the data based on the analysis result of the received query , Calculate an expected processing time at the first node, calculate an expected processing time for the number of second nodes to execute, and an expected processing time at the first node; The number of second nodes instructing execution of the database operation can be determined based on an expected processing time with respect to the number of second nodes to be executed.
[0036]
[Action]
The decision management node determines the distribution node based on an analysis result of the query of the analysis unit, calculates an expected processing time in the distribution node, and determines a combined node based on the processing time. The determining means allocates the distribution of the extracted information to the combined nodes equally to the combined nodes based on the estimated extracted information amount at the determined distributed nodes.
[0037]
Each of the determined distribution nodes extracts information from the storage unit based on the analysis result of the inquiry and distributes the extracted information to other nodes. The distribution node and the combination node perform processing independently, and the combination node sequentially inputs the distributed information from the distribution node, and performs processing for each input information. Each of the determined joining nodes rearranges the information distributed from the distribution node, merges the rearranged information when there are a plurality of rearranged information, and matches the query based on the merged information And outputs the result for the query obtained from the join node.
[0038]
Further, the determining means determines from the calculation result of the expected processing time in the distribution node that the distribution node rearranging means rearranges the distribution node for which processing ends earlier after distribution processing. To do. The determined distribution node rearranging means rearranges information distributed by the distribution node.
[0039]
Further, the determining unit calculates an expected processing time in the matching unit and the output unit, and based on the calculation result, when the processing time of the output unit is larger than the processing time of the matching unit, It determines so that the said matching means may perform the said merge process. The determined matching means performs a merge process.
[0040]
In addition, when the processing time is determined in advance, in order to perform the processing within the processing time, the determination means determines the number of the joining nodes determined based on the expected processing time in the distribution node as a predetermined number. Decide to increase. As a result, the number of combined nodes increases, and the reordering means of the combined nodes can perform the reordering process in a short time, and therefore performs the merge process after the reordering process is completed.
[0041]
According to the query processing method of the present invention, the number of nodes can be determined corresponding to the database operation executed at each node. Also, if there is a variation in the data division, the data is divided evenly into each node, and each database operation executed at each node is parameterized to equalize the expected processing time. Therefore, the pipeline operation can be performed smoothly.
[0042]
According to another configuration of the invention, the third node receives an inquiry from a user, analyzes the inquiry, and based on the analysis result, at least one of the plurality of first nodes. The first node is instructed to extract the data, and at least one second node of the second nodes is instructed to execute the database operation. The third node determines the distribution of the extracted data to the determined second node based on an expected amount of extracted data in the determined first node. Allocate evenly.
[0043]
Each of the determined first nodes, when instructed, retrieves the data stored in the storage means and sends the retrieved data to the network for distribution to other nodes. The first node and the second node perform processing independently, and the determined second node sequentially inputs the distributed data from the determined first node, and the input data Process each time. Each of the determined second nodes receives data sent to the network when instructed, performs a database operation on the received data, and sends the result to the network. The third node receives the calculation result sent on the network and outputs the result for the inquiry.
[0044]
In addition, the third node determines whether the first node after the distribution process with respect to the first node that ends processing earlier from the calculation result of the expected processing time in the determined first node. Decide to sort the data. The determined first node rearranges the data after the distribution process.
[0045]
Further, the third node calculates an expected processing time in the matching process and a result output process for the query, and based on the calculation result, the processing time of the output process is calculated based on the calculation result. If the time is longer than the processing time, the merge processing is performed in the matching processing.
[0046]
In addition, when the processing time is determined in advance, the third node increases the number of the second nodes determined based on the processing time by a predetermined number in order to perform processing within the processing time. To decide. As a result, the number of second nodes increases, and the rearrangement process can be performed in a shorter time. A merge process can be performed after the rearrangement process is completed.
[0047]
According to the present invention, it is possible to determine a node that takes out and distributes data and a node that executes a database operation. Also, if there is a variation in the data division, the data is divided equally to each node, each database operation executed on each node is parameterized, and the expected processing time is equalized, so the processing time between each node Therefore, the pipeline operation can be performed smoothly.
[0048]
【Example】
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0049]
FIG. 2 shows a conceptual diagram of the database system of this embodiment. In FIG. 2, the database system includes a plurality of application programs (hereinafter abbreviated as AP) 10 and 11 created by the user, and a database such as query processing and resource management. The DBMS 20 that manages the entire system and the operating system (hereinafter referred to as the operating system) that reads and writes the data to be input / output processed in the database process and manages the entire computer system. (The operating system is abbreviated as OS) 30, a database 40 for storing data to be subjected to database processing, and a dictionary 50 for managing database definition information. The DBMS 20 is connected to another database management system. The dictionary 50 also stores optimization information related to the join columns used in this embodiment.
[0050]
The DBMS 20 includes a system control unit 21 that performs input / output management in addition to management and control of the entire system, a logical processing unit 22 that performs logical processing related to an inquiry, and a physical processing unit 23 that executes physical processing of a database. And a database buffer 24 for storing data to be processed by the DBMS 20. The logic processing unit 22 also includes a query analysis 220 that performs query syntax analysis and semantic analysis, a static optimization process 221 that generates an appropriate processing procedure, and a code generation 222 that generates code corresponding to the processing procedure. A dynamic optimization process 223 for selecting an optimal process procedure candidate generated in the static optimization process 221 and a code interpretation execution unit 224 for interpreting and executing the code. The physical processing unit 23 also includes a data access process 230 that realizes condition determination, editing, and record addition of the accessed data, a database buffer control 231 that controls reading and writing of database records, an input A mapping process 232 for managing the storage location of data to be output and an exclusive control 233 for realizing exclusive control of resources shared by the system are provided.
[0051]
FIG. 3 shows an example of a hardware configuration to which the present invention is applied. Specifically, FIG. 3 shows an application configuration example of a parallel processor system in which a processor and a disk device constitute one node and a plurality of nodes. In FIG. 3, processors 60 to 65 and disk devices 70 to 75 are connected by an interconnection network 80. The hardware configuration shown in FIG. 3 is a configuration for parallel processing of the database system shown in FIG. 2 by a plurality of processors, and the processing is distributed to each node.
[0052]
FIG. 1 shows a configuration when the functions are distributed for each of the above nodes. FIG. 1 shows a schematic diagram of a database system to which this embodiment is applied. Hereinafter, a processing example of the parallel database system will be described with reference to FIG. In this example, parallel processing is applied to a search request for a database. In FIG. 1, each node is assigned to each node a sorting function for extracting and distributing data and a merging function for combining data sorted by a plurality of nodes. Some nodes have only a sort function, and others have a sort function and a merge function. The database consists of a table that can be viewed by the user in a two-dimensional table format, and the table has data for each row or row. A row is composed of one or more attributes (this is referred to as “column”). In FIG. 1, there are T1 and T2 as database tables. Table T1 is stored from node 1 (90) to node 4 (91), and table T2 is stored from node 5 (92) to node 8 (93). Each of these nodes is a distribution node, and data extraction processing and data distribution processing are executed based on a table stored in the distribution node. Nodes 9 (94) to 11 (96) are combined nodes, receive data output from nodes 1 to 4 and 5 to 8, and perform partial column sort processing and merge processing to complete columns. Execute creation. Further, the node 12 (97) is a decision node that receives an inquiry, analyzes the inquiry, and determines the number of distribution nodes and combination nodes that execute processing for the inquiry. The node 12 (97) receives and outputs the data output from the nodes 9-11. These node groups are connected by an interconnection network 80. Nodes 1 to 4 and nodes 5 to 8 and nodes 9 to 11 operate in parallel and are processed by nodes 1 to 4 and nodes 5 to 8, respectively. The result is a pipeline operation in which processing is immediately performed in the nodes 9 to 11 (hereinafter referred to as a parallel pipeline operation). Similarly, the nodes 9 to 11 and the node 12 perform the pipeline operation. Hereinafter, the partial column sorting process in the nodes 9 to 11 is referred to as a slot sort process, and the complete column creation process is referred to as an N-way merge process. The slot sort process refers to a sort process within a page that targets a page in which data is stored. If reading is performed in the slot order, rows can be accessed in ascending order. The N-way merge process uses an N-way buffer to input N sort sequences at each merge stage and finally create one sort sequence.
[0053]
A query for database search processing is, for example, as follows.
[0054]
SELECT T1. C3, T2. C3
FROM T1, T2
WHERE T1. C1 = T2. C1
AND T1. C2 =?
When such an inquiry is received at the node 12, the optimal distribution processing method is selected at the node 12, and each node is instructed via the network. In the above inquiry, the table T1 is stored from the node 1 (90) to the node 4 (91), and the table T2 is stored from the node 5 (92) to the node 8 (93). And data distribution processing is executed. Further, the nodes 9 (94) to 11 (96) sequentially receive the data output from the nodes 1 to 4 and the nodes 5 to 8, and execute the sort process and the join process. The node 12 (97) receives and outputs the data output from the nodes 9-11. This completes the database search.
[0055]
Next, the relationship between the processing times of the respective nodes will be described with reference to FIG. FIG. 4 shows a schematic diagram for explaining the parallel pipeline operation. In FIG. 4, reference numerals 100 and 101 correspond to the processing in node 1 (90) to node 4 (91) and node 5 (92) to node 8 (93) in FIG. Execute. 110 and 111 correspond to the processes in the node 9 (94) to the node 11 (96), and the slot sort process, the N-way merge process, and the matching process are executed. 120 corresponds to the processing in the node 12 (97), and the requested data output processing is executed. Along the time axis, the data processed in the data extraction processing and data distribution processing 100 and 101 is sequentially transferred to the slot sorting processing 110 and 111 and executed in a pipeline manner. The process from the data extraction process to the slot sort process is called an extraction phase. Further, the N-way merge processing 110 and 111 is simply executed in parallel at each node. This N-way merge processing period is called a merge phase. Further, the result of the matching process is sequentially transferred to the request data output process 120 and executed in a pipeline manner. This process from matching to request data output is called a combination phase. The time chart shown in FIG. 4 shows the processing contents when the query example shown in FIG. 1 is applied. In the retrieval phase, the processing time from node 1 (90) to node 4 (91) is shown as T1 data retrieval / data distribution processing time 130. The processing time from the node 5 (92) to the node 8 (93) is indicated by the T2 data fetch / data distribution processing time 131, the transfer time in the interconnection network 80 is indicated by the data distribution transfer time 140, and the node 9 (94 ) To node 11 (96) are executed as indicated by T1 / T2 slot sort processing time 150, respectively. In FIG. 4, the take-out phase ends until the slot sort process completion wait 180. In the merge phase, the processing time from the node 9 (94) to the node 11 (96) is executed at the time indicated by the T1 / T2N way merge processing time 151. This merge phase ends with the T1 / T2N way merge process waiting 181. In the joining phase, the processing time in the node 9 (94) to the node 11 (96) is indicated by the matching processing time 152, the processing time in the mutual connection network 80 is indicated by the joining result transfer time 160, and in the node 12 (97). The processing time is indicated by a request data output processing time 170, and each is executed within that time.
[0056]
Next, a method for distributing processing to each node group of the node 12 in FIG. 1 will be described with reference to FIG. FIG. 5 is an explanatory diagram showing a distribution method to each node group in the data distribution processing. As a premise, a node group that performs data extraction / data distribution processing includes ten nodes 1 to 10 including processors 200 to 230 and disk devices 201 to 231. In addition, it is assumed that the node group that performs the combining process includes five nodes 11 to 15 including processors 240 to 250 and disk devices 241 to 251. The dictionary 50 stores optimization information 51 related to the joined columns. The optimization information 51 is information for equally dividing the data in the database. For example, since the number of data for the combined column is not usually uniform, the data is divided by the combined column so that the number of data is uniform. To do. As shown in FIG. 5, it is shown that the data stored in the nodes 1 to 10 can be equally divided in the divided ranges from v1 to v10. In this case, in order to equally divide the data into the nodes 11 to 15, the node numbers 11, 12, 13, 14, and 5 are divided into five sections of v1 to v2, v3 to v4, v5 to v6, v7 to v8, and v9 to v10, respectively. Distribution processing means for associating 15 may be provided. If the optimization information does not exist, data distribution may be performed by setting an appropriate hash function. In this manner, the node 12 in FIG. 1 includes the distribution processing means, and distributes the processing to each node group when performing the N-way merge processing. Thereby, in the above case, data can be equally divided into the nodes 11 to 15, and the processing time becomes equal.
[0057]
Next, a method for determining the number of coupled nodes when performing N-way merge processing will be described with reference to FIG. FIG. 6 is a schematic diagram for explaining a method for determining the number of coupled nodes.
[0058]
Each phase of parallel connection processing in FIG. 1 and the processing time of each processing are graphed and laid out according to the outline of the parallel pipeline operation shown in FIG. In FIG. 6, it is assumed that data extraction / data distribution processing is executed in the nodes 1 to 8 and processing times of 300 to 305 are required. Here, it is assumed that the processing time 304 of the node 5 is the maximum processing time. The slot sort processing time can be derived from the number N of coupled processing nodes, predetermined system characteristics (CPU performance, disk device performance, etc.), and a database calculation method. It can be obtained by the following formula.
[0059]
[Expression 1]
E = a / N + b * N + c
In order to maximize the effect at the time of performing pipeline processing, the combined node allocation number 350 that is the intersection of the performance characteristics of the slot sort processing and the maximum processing time 304 can be obtained as the number of nodes. When the combined node allocation number 350 is determined, the N-way merge processing time 320 and the matching processing time 330 can be similarly estimated from the performance characteristics of the N-way merge processing and the performance characteristics of the matching process. The total of these processing times is the total processing time for the inquiry. The total number of processing times (response time from inquiry to output) is determined by determining the number of nodes to be combined and sequentially merging and simultaneously processing the data distributed in the data extraction / data distribution processing. Can be shortened.
[0060]
Specific examples of performance characteristics used when determining the number of coupled nodes are shown below. For example, the number of rows is 10,000,000 in both Table T1 and Table T2, the number of conditions is T1-1 (the total number of rows is narrowed down to 1%), and the number of distribution nodes for data retrieval / data distribution processing is Both Table T1 and Table T2 are equally divided into 16 nodes, the number of coupled nodes is 8, the processor performance is 50 MIPS (50 million instructions executed per second), and the network transfer rate is 20 Mbytes / second. . The result of processing by the actual database management system under such conditions or the result calculated from the performance model is as follows.
[0061]
The processing time of the distribution nodes in Table T1 and Table T2 is 180 seconds, T1 / T2 slot sort processing time is 80 seconds, N-way merge processing time is 380 seconds, matching processing time is 110 seconds, and request data output time is 10 seconds. It becomes. Based on the processing performance of these results, the processing time for the query is estimated.
[0062]
Next, a processing time adjustment method (tuning method) for further shortening the response time based on the method for determining the number of coupled nodes shown in FIG. 6 will be described with reference to FIG. 7, FIG. 8, and FIG. . The method described below is calculated in advance when the distribution processing means of the node 12 determines the distribution of processing to each node group, and the distribution is determined from the result.
[0063]
FIG. 7 shows a schematic diagram of slot sorting pre-processing. It is assumed that data extraction / data distribution processing is executed in the nodes 1 to 8 and processing times of 300 to 305 are required. The processing time for each node varies depending on the number of data in each table. Further, the slot sort process is set to be executed by the combination process node group. If there is a variation in processing time for each node, consider a processing procedure for transferring the slot sort processing to the data extraction / data distribution processing node group. As shown in FIG. 7 as pre-processing of slot sorting, slot sorting processing is performed at a node where data extraction / data distribution processing is completed earlier. According to this processing, the slot sort processing time in the node having the combined node allocation number 350 can be reduced from 310 to 312. The N-way merge processing is shifted in the processing time difference 311. This is nothing but extending the length of the slot sort process. Thereby, the N-way merge processing time can be reduced, and as a result, the response time can be reduced.
[0064]
FIG. 8 shows a slot sort sequence length tuning outline diagram. For example, when multiple processing is performed within the time, such as when there is a restriction on processing time, each database operation executed at each node is parameterized and time adjustment (tuning) based on the expected processing time The method of doing will be described. The number of join processing nodes is increased as much as possible from the join node allocation number 350 obtained in FIG. 6 to shorten the response time. In this case, the number of combined node assignments is 351. Assuming that the combined node allocation number is 351, the slot sort processing time is reduced from 310 to 312. In order to maximize the pipeline effect, the N-way merge process is shifted to the slot sort process at the processing time 311. As a result, the number of merges in the N-way merge process is reduced, the processing time can be reduced to 320, and as a result, the response time can be reduced.
[0065]
FIG. 9 shows a schematic diagram of N-way merge frequency tuning. When the matching processing time 330 determined by the combined node allocation number 350 is shorter than the request data output processing time 340, the merge processing at the final stage of the N-way merge processing can be shifted to the matching processing. If the sum of the merge processing time 331 at the final stage of the N-way merge process and the matching process time 330 does not exceed the requested data output processing time 340, the merge process at the final stage is shifted to the matching process. Thereby, the response time can be reduced.
[0066]
Next, the operation flow of the database management system in the present embodiment will be described. 10, FIG. 11, FIG. 12, FIG. 13, FIG. 14 and FIG. 15 show a flowchart of DBMS processing in this embodiment. In FIG. 10, the DBMS includes a query analysis process 400 that performs query analysis by query analysis processing (step 220), static optimization processing (step 221), and code generation (step 222) performed before query execution, A constant optimization is performed, and a dynamic optimization process (step 223) for selecting a processing procedure and a query execution process 410 for performing an execution process on the query by code interpretation execution (step 224) of the query are performed.
[0067]
The outline of each processing unit will be described below.
[0068]
(A) Query analysis processing 400
10A and 10C, in the query analysis (step 220), syntax analysis and semantic analysis of the query sentence input by the application program in the node 12 are executed (step 2200). In FIG. 10A, in the static optimization process (step 221), the ratio of data satisfying the condition is estimated from the conditional expression appearing in the query in the node 12, and based on the preset rule. Create valid access path candidates (especially, select an index) and create processing procedure candidates. In the code generation (step 222), the processing procedure candidates are expanded into an execution format in the node 12.
[0069]
(B) Query execution processing 410
In FIG. 10B, in the dynamic runtime optimization (step 223), the processing procedure to be executed in each node group is determined based on the constant substituted in the node 12. In the code interpretation execution (step 224), the processing procedure is interpreted and executed in each node.
[0070]
Next, a detailed processing flow of each processing unit will be described.
[0071]
In FIG. 10D, in the dynamic optimization process (step 221), the predicate selection rate of the conditional expression appearing in the query is estimated (step 2210), the access path consisting of an index or the like is pruned (step 2211), A processing procedure candidate is generated by combining these access paths (step 2212).
[0072]
In FIG. 10E, in the predicate selection rate estimation (step 2210), it is checked whether or not a variable appears in the query conditional expression (step 22101). If a variable appears, it is checked whether there is column value distribution information in the conditional expression (step 22104). Exit if it exists. If it does not exist, a default value is set according to the type of conditional expression (step 22105), and the process ends. If no variable appears, it is checked whether the conditional expression includes column value distribution information (step 22104). If it does not exist, a default value is set according to the type of conditional expression (step 22105), and the process ends. If it exists, the selectivity is calculated using the column value distribution information (step 22103).
[0073]
In FIG. 11, in the access path pruning 2212, the index of the column appearing in the query conditional expression is registered as an access path candidate (step 22120). Next, it is checked whether the table to be accessed by the query is divided and stored in a plurality of nodes (step 22121). If stored separately, the parallel table scan is registered as an access path candidate (step 22123). If not stored separately, the table scan is registered as an access path candidate (step 22123). It is checked whether the selection rate of each conditional expression has already been set (step 22124). If already set, the index of the conditional expression that minimizes the selection rate for each table is set as the highest priority of the access path (step 22125). If not set, the maximum value / minimum value of the selection rate of each conditional expression is acquired (step 22126). Finally, the selection criteria for each access path is calculated from the system characteristics such as CPU performance and IO performance (step 22127), and the selection rate in the access path combining a single index or a plurality of indexes is less than the above selection criteria. Registration as an access path candidate (step 22128).
[0074]
In FIG. 12, the processing procedure candidate generation 2213 checks whether the table to be accessed in the query is divided and stored in a plurality of nodes (step 22130). If it is stored separately, the process proceeds to step 22135. If it is not stored separately, it is checked whether or not sort processing is included in the processing procedure candidate (step 22131). If it is included, the process proceeds to step 22135. If not included, it is checked whether the access path of the table to be accessed by the query is unique (step 22132). If it is unique, a single processing procedure is created (step 22133). Is created (step 22134), and the process ends. In step 22135, the query is broken down into two-way joins that can be joined. Corresponding to the storage node group of the table to be divided and stored, the data reading / data distribution processing procedure is registered as a candidate. Further, the slot sort processing procedure is registered as a candidate (step 22136). Corresponding to the combination processing node group, the slot sort processing procedure, the N-way merge processing procedure, and the matching processing procedure are registered as candidates, and the slot sort continuous length and the number of merge processing are parameterized (step 22137). The request data output processing procedure is registered in the request data output node (step 22138). Finally, when all the evaluations on the decomposition result are completed (step 22139), the process ends.
[0075]
In FIG. 13, the code generation 222 checks whether or not the processing procedure candidate is unique (step 2220). If it is unique, the process proceeds to step 2223. If not unique, optimization information consisting of column value distribution information or the like is embedded in the processing procedure (step 2221), and a data structure for selecting the processing procedure is created based on the constants assigned during query execution (step 2222). Finally, the processing procedure is expanded into an execution format (step 2223).
[0076]
In FIG. 14, the dynamic optimization process 223 checks whether or not the created processing procedure is single (step 22300). If it is single, it ends. If not single, the selectivity is calculated based on the assigned constant (step 22301). It is checked whether or not parallel processing procedures are included in the processing procedure candidates (step 22302). If not included, a processing procedure is selected according to the access path selection criteria (step 22313), and the process ends. If included, the optimization information (column value distribution information of the join column, the number of rows in the table to be accessed, the number of pages, etc.) is input from the dictionary (step 22303), and processing for data retrieval / data distribution The time is calculated as described above in consideration of each system characteristic (step 22304). From this processing time, the number p of nodes to be allocated to the joining process is determined, and this processing procedure a1 is determined (step 22305). It is checked whether or not there is a variation in the data extraction / data distribution processing time (step 22306). If there is variation, a processing procedure a2 for executing slot sorting processing in the data fetch / data distribution processing node group is set (step 22307). Next, a processing procedure a3 is set in which the number of combined nodes allocated p is increased by α (step 22308). If the requested data processing time is longer than the sum of the matching processing time and one N-way merge processing time (step 22309), a processing procedure a4 is set in which one N-way merge processing is transferred to the matching processing ( Step 22310). In the processing procedures a1 to a4, an optimal processing procedure is selected from the viewpoints of minimum response time, minimum load on each node, and small influence on other transaction response performance (step 22311). Data distribution information is created based on the optimization information (step 22312). If there is no optimization information, data distribution information is created according to the combined column evaluation value of the hash function. A processing procedure is selected according to the access path selection criteria (step 22313), and the process ends.
[0077]
In FIG. 15, in the code interpretation execution processing 224, processing is performed in accordance with the corresponding processing procedure in each set node.
[0078]
First, each node determines whether or not data extraction / data distribution processing is set (step 22400). If the data retrieval / data distribution process is set, the database stored in the storage device of each node is accessed and the conditional expression is evaluated (step 22401). Data is extracted based on the data distribution information created based on the optimization information, and the data is sequentially distributed to the buffers of the respective joining nodes (step 22402). It is determined whether or not the buffer of each joining node is full. If the buffer is full, it is transferred to the corresponding joining node in page format. When all the data corresponding to the inquiry is extracted and distributed, the process ends (step 22404).
[0079]
Each node determines whether slot sort processing is set (step 22405). If slot sort processing is set, page format data from the data fetch / data distribution processing node is received (step 22406), and slot sort processing is sequentially performed on the received data (step 22407). The processed slot sort result is temporarily stored, and the slot sort process is terminated (step 22408).
[0080]
Also, it is determined whether or not N-way merge processing is set (step 22409). If the N-way merge process is set, the N-way merge process is executed based on the slot sort result (step 22410), the N-way merge process result is temporarily stored in a buffer or the like (step 22411), and the N-way merge process is executed. Exit.
[0081]
Further, it is determined whether or not the matching process is set (step 22412). If the matching process is set, the sort list of the N-way merge process result is matched, and data is set in the output buffer (step 22413). If the output buffer is full, it is transferred to the request data output node in page format (step 22415).
[0082]
Further, it is determined whether or not the request data output process is set (step 22416). If the requested data output process is set, it is determined whether or not there is a page format data transfer from the joining node (step 22417). If there is a page format data transfer, the page format data is received (step 22418), and the query processing result is output to the application program. If there is no page format data transfer, the query processing result is output as it is. It outputs (step 22419).
[0083]
Further, in the above-described code interpretation execution process, when the slot sorting process is executed in the data extraction / data distribution processing node group when the processing time varies, the code interpretation is performed after the data extraction / data distribution process is completed. The execution process 224 is executed again to perform the slot sort process.
[0084]
Furthermore, if the N-way merge process result is not a complete sort column in step 22413, the final stage merge and matching process are performed.
[0085]
By processing as described above, the inquiry response time of the database management system can be shortened.
[0086]
The joining node assignment method shown in FIG. 6 and the tuning methods shown in FIGS. 7, 8, and 9 may be applied independently or in any combination. That is, the dynamic optimization process 223 assumes a case where all combinations can be applied. Further, in the data fetching process, the application of a parallel input / output access method comprising a plurality of disk devices, the application of a batch input / output method / prefetch input / output method, and a data distribution method using optimized information or a hash function for data distribution processing Application, application of a parallel sorting method to N-way merge processing, application of a matching processing method between nodes to matching processing, application of a parallel reception processing method by assigning a plurality of nodes to request data output processing, and the like are also conceivable. In step 22309 and step 22310, one way N-way merge processing is assumed, but it may be generally n times (n ≧ 1).
[0087]
With respect to the parallel pipeline operation shown in FIG. 4, when the joining node allocation method shown in FIG. 6 and the tuning method shown in FIGS. 7, 8, and 9 are applied, among the extraction phase, merge phase, and joining phase, There are cases where the merge phase can be omitted. That is, it is possible by extending the slot sort sequence length and moving the N-way merge process. In this case, the merge phase process is omitted even in the query execution process.
[0088]
The inquiry processing method of the present invention is not limited to the combined use of the rule using statistical information and cost evaluation, but can be applied as long as a processing procedure for providing appropriate database reference characteristic information can be obtained. For example, the present invention can also be applied to a DBMS that performs optimization processing such as cost evaluation only, rule usage only, or cost evaluation and rule usage combined.
[0089]
The present invention can be realized through a tightly coupled / loosely coupled multiprocessor system software system of a large computer, or through a tightly coupled / loosely coupled complex processor system in which a dedicated processor is prepared for each processing unit. It can also be realized. Further, even a single processor system is applicable if a parallel process is assigned for each processing procedure.
[0090]
According to the present embodiment, the number of nodes is determined corresponding to the database operation executed at each node, and if there is a variation in the data division, the data is divided equally into each node, Since each database operation to be executed is parameterized and the expected processing time is equalized, there is no bias in processing time among the nodes, and a pipeline operation can be performed smoothly, and high-speed query processing can be realized.
[0091]
【The invention's effect】
The number of nodes is determined corresponding to the database operation executed at each node, the data is divided equally among the nodes, and the processing time executed at each node is equalized, so there is no bias in processing time among the nodes. , High-speed query processing can be realized.
[Brief description of the drawings]
[Fig. 1] Parallel connection processing diagram [Fig. 2] Database system configuration diagram [Fig. 3] Hardware configuration diagram [Fig. 4] Parallel pipeline operation overview diagram [Fig. 5] Data distribution processing overview diagram [Fig. 6] Schematic diagram of combined node allocation [Fig. 7] Schematic diagram of slot sort pre-processing [Fig. 8] Schematic diagram of slot sort run length tuning [Fig. 9] Schematic diagram of N-way merge count tuning [Fig. Database management system flowchart [FIG. 12] Database management system flowchart [FIG. 13] Database management system flowchart [FIG. 14] Database management system flowchart [FIG. 15] Database management system flowchart [description of symbols]
DESCRIPTION OF SYMBOLS 10, 11 ... Application program, 20 ... Database management system, 22 ... Logic processing part, 220 ... Query analysis, 221 ... Static optimization processing, 222 ... Code generation, 223 ... Dynamic optimization processing, 224 ... Code interpretation execution , 30 ... operating system, 40 ... database, 50 ... dictionary, 80 ... interconnection network, 90, 91, 92, 93, 94, 95, 96, 97 ... node.

Claims (2)

取り出し要求に従って、格納されたデータを取り出して送出する複数の第1のノードと、
入力された結合演算要求にしたがって、前記第1のノードから送出されたデータについて結合演算処理を実行し、該結合演算処理結果を出力する複数の第2のノードと、
入力された問い合わせ要求を解析し、ハッシュ関数を用いて作成されたデータ分配情報のキーレンジの数に応じた複数の前記結合演算要求を生成して前記第2のノードにそれぞれ分配し、前記第2のノードにそれぞれ分配された前記結合演算要求にて対象となるデータを前記データ分配情報に従って前記第2のノードそれぞれに分配する取り出し要求を複数生成し、当該生成した取り出し要求を前記第1のノードにそれぞれ送出し、前記結合演算要求の結合演算処理結果を、前記第2のノードからそれぞれ受け取り、前記問い合わせ要求の処理結果を出力する第3のノードとを有し、
前記第2のノードは、当該結合演算処理の途中結果を一時格納する途中結果格納手段を備えること
を特徴とするデータベース管理システム。
A plurality of first nodes for retrieving and sending stored data in accordance with a retrieval request;
A plurality of second nodes for executing a join operation process on the data sent from the first node in accordance with the input join operation request and outputting the join operation process result;
It analyzes the input query request, respectively distributed to the second node to generate a plurality of the binding operation request according to the number of key ranges of data distribution information created by using a hash function, the first A plurality of extraction requests for distributing the target data to each of the second nodes according to the data distribution information in the join operation request distributed to each of the two nodes ; A third node that sends to each node, receives a join operation processing result of the join operation request from each of the second nodes, and outputs a processing result of the inquiry request;
The database management system according to claim 2, wherein the second node includes intermediate result storage means for temporarily storing intermediate results of the join operation processing.
複数の第1のノード、複数の第2のノードおよび第3のノードを備えるデータベース管理システムにおける問い合わせ方法であって、
前記第1のノードは、取り出し要求に従って、格納されたデータを取り出して送出し、
前記第2のノードは、入力された結合演算要求にしたがって、前記第1のノードから送出されたデータについて結合演算処理を実行し、当該結合演算処理の処理の途中結果を一時格納し、前記結合演算処理の処理結果を出力し、
第3のノードは、入力された問い合わせ要求を解析し、ハッシュ関数を用いて作成されたデータ分配情報のキーレンジの数に応じた複数の結合演算要求を生成して前記第2のノードにそれぞれ分配し、前記第2のノードにそれぞれ分配された前記結合演算要求にて対象となるデータを前記データ分配情報に従って前記第2のノードそれぞれに分配する取り出し要求を複数生成し、当該生成した取り出し要求を前記第1のノードにそれぞれ送出し、前記結合演算要求の結合演算処理結果を、前記第2のノードからそれぞれ受け取り、前記問い合わせ要求の処理結果を出力すること
を特徴とする問い合わせ処理方法。
An inquiry method in a database management system comprising a plurality of first nodes, a plurality of second nodes, and a third node,
The first node retrieves and sends out stored data in accordance with a retrieval request;
It said second node in accordance with the input coupled calculation request, perform the binding processing on the data sent from the first node, and temporarily stores the intermediate results of processing of the binding processing, the bond Output the processing result of the arithmetic processing,
The third node analyzes the input query request, generates a plurality of join operation requests according to the number of key ranges of the data distribution information created using the hash function, and sends each request to the second node. dispensed, a retrieval request to be distributed to each of the second node data of interest in the distributed respectively to the second node the join operation request according to the data distribution information generates a plurality, fetch requests thus generated query processing method and sends to each of the first node, a binding operation result of the join operation request, receiving from each of said second node, and outputs the processing result of the query request.
JP2000309450A 2000-10-10 2000-10-10 Database management system and query processing method Expired - Fee Related JP3819695B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000309450A JP3819695B2 (en) 2000-10-10 2000-10-10 Database management system and query processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000309450A JP3819695B2 (en) 2000-10-10 2000-10-10 Database management system and query processing method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2000012280A Division JP2000148557A (en) 2000-01-01 2000-01-20 Database management system and enquiry processing method

Publications (2)

Publication Number Publication Date
JP2001147845A JP2001147845A (en) 2001-05-29
JP3819695B2 true JP3819695B2 (en) 2006-09-13

Family

ID=18789606

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000309450A Expired - Fee Related JP3819695B2 (en) 2000-10-10 2000-10-10 Database management system and query processing method

Country Status (1)

Country Link
JP (1) JP3819695B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5310737B2 (en) * 2008-12-11 2013-10-09 富士通株式会社 Configuration management apparatus, configuration management program and method

Also Published As

Publication number Publication date
JP2001147845A (en) 2001-05-29

Similar Documents

Publication Publication Date Title
JP3266351B2 (en) Database management system and query processing method
US6556988B2 (en) Database management apparatus and query operation therefor, including processing plural database operation requests based on key range of hash code
US6505187B1 (en) Computing multiple order-based functions in a parallel processing database system
US6477523B1 (en) Selectivity prediction with compressed histograms in a parallel processing database system
US5325525A (en) Method of automatically controlling the allocation of resources of a parallel processor computer system by calculating a minimum execution time of a task and scheduling subtasks against resources to execute the task in the minimum time
US7895151B2 (en) Fast bulk loading and incremental loading of data into a database
JP4571609B2 (en) Resource allocation method, resource allocation program, and management computer
JP2009015534A (en) Resource allocation method, resource allocation program, and resource allocation device
Sukhwani et al. A hardware/software approach for database query acceleration with FPGAs
US8214408B2 (en) Method, database system and computer program for joining temporal database tables
JP2008234495A (en) Query processing system of database using multi-operation processing using synthetic relational operation
Gates et al. Apache Pig's Optimizer.
Michiardi et al. Cache-based multi-query optimization for data-intensive scalable computing frameworks
JPH06309284A (en) Inquiry processing load distributing method
JP3819695B2 (en) Database management system and query processing method
JP3732655B2 (en) Database management system, database management apparatus, and query processing method
JP3819694B2 (en) Database management system and query processing method
JP3538322B2 (en) Database management system and query processing method
JP4422697B2 (en) Database management system and query processing method
JP3668243B2 (en) Database management system
JP3667997B2 (en) Database management device
JP2001147847A (en) Database management system and inquiry processing method
Chen et al. Parallel XPath query based on cost optimization
JP2000148557A (en) Database management system and enquiry processing method
WO2021215101A1 (en) Data management system and data management method

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060307

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060508

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: 20060613

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060615

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090623

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100623

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100623

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110623

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees