JP2016009225A - Database management device, database management method, program, and recording medium - Google Patents
Database management device, database management method, program, and recording medium Download PDFInfo
- Publication number
- JP2016009225A JP2016009225A JP2014127831A JP2014127831A JP2016009225A JP 2016009225 A JP2016009225 A JP 2016009225A JP 2014127831 A JP2014127831 A JP 2014127831A JP 2014127831 A JP2014127831 A JP 2014127831A JP 2016009225 A JP2016009225 A JP 2016009225A
- Authority
- JP
- Japan
- Prior art keywords
- execution plan
- database server
- resource usage
- database
- sql
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、データベース管理装置に関し、特にデータベースの処理速度を向上させることができるデータベース管理装置に関する。 The present invention relates to a database management apparatus, and more particularly to a database management apparatus that can improve the processing speed of a database.
データベースシステムにおいてクエリ文が処理される場合、処理時間を早めるため、テーブル結合や条件処理を最適と判断された順序で実行するための実行計画というものが利用される。通常、データベースシステムが動的に実行計画を決定し、処理が高速に行われるように調整している。 When a query statement is processed in the database system, an execution plan for executing table joins and condition processing in the order determined to be optimal is used in order to speed up the processing time. Usually, the database system dynamically determines an execution plan and adjusts so that processing is performed at high speed.
実行計画の調整には、対象テーブルのデータ件数などの表統計情報、インデックスのリーフブロック、リーフの深さなどの索引統計情報などの情報を元にデータベースシステムが自動的に判定している。 The adjustment of the execution plan is automatically determined by the database system based on information such as table statistical information such as the number of data in the target table, index statistical information such as index leaf blocks and leaf depth.
しかし、以前に入力された第1クエリ文と完全に同一である第2クエリ文、または、特定の条件、例えばパラメータのみが異なる第2クエリ文が入力される場合、第2クエリ文に対する実行計画は第1クエリ文に対する実行計画と殆ど同一であるにもかかわらず、従来のDBMSは、第2クエリ文に対する実行計画を再度生成するので、システム運用の効率性が低下するという課題があった。 However, when a second query statement that is completely identical to the previously input first query statement or a second query statement that differs only in specific conditions, for example, parameters, is input, an execution plan for the second query statement Is almost the same as the execution plan for the first query statement, but the conventional DBMS regenerates the execution plan for the second query statement, which causes a problem that the efficiency of system operation is reduced.
上記課題を解決するため、特許文献1には、過去に実行したクエリ文をメモリに格納しておき、新たなクエリ文と過去のクエリ文とがマッチングすれば、過去の特定のクエリ文を利用して新たなクエリ文の実行計画を生成し、メモリ資源の効率化、システム速度の向上を図るデータベース管理方法が提案されている。
In order to solve the above problems,
しかしながら、特許文献1のデータベース管理方法であっても、実行計画によっては著しく遅い実行計画が採用されるケースが発生することがある。たとえば、データベースソフトを作成しているソフトウェアベンダが仕様を変更して、生成される実行計画の方針が変更された場合、クエリ文の実行が極端に遅くなる例は少なくない。
However, even with the database management method disclosed in
また、通常時のデータベースシステムであれば、クエリ文の処理が遅延した段階で管理者がヒント句を使用して実行計画を変更する処理を行えるが、夜間のバッチ処理などの場合、遅延が生じた段階で管理者を呼んで対応しなければならず、遅延の影響が大きくなってしまう。 In addition, in a normal database system, the administrator can change the execution plan using hint phrases when the query processing is delayed. However, in the case of nighttime batch processing, there is a delay. At this stage, an administrator must be called to deal with it, and the effect of delay will increase.
本発明は、上記問題を解決するためになされたものであり、過去に正常な時間で処理された実行計画を記憶しておき、新たな実行計画により処理時間の遅延が生じた場合は、過去の正常な時間で処理した実行計画に戻して、少なくとも過去の正常な時間に近い処理時間で処理できるように制御することを目的とする。 The present invention has been made in order to solve the above problem, and stores an execution plan processed in a normal time in the past, and if a delay in processing time occurs due to a new execution plan, the past It is an object of the present invention to return to the execution plan processed in the normal time and control the processing so that the processing can be performed in the processing time close to the past normal time.
本発明は、データベースサーバと接続可能なデータベース管理装置であって、入力されたSQL文を前記データベースサーバに送信する送信手段と、前記データベースサーバのリソース使用量を取得するリソース使用量取得手段と、前記データベースサーバから、前記入力されたSQL文に対応して処理される実行計画を受信する実行計画受信手段と、前記データベースサーバのリソース使用量が異常であると判断する所定の閾値を記憶する閾値記憶手段と、前記リソース使用量取得手段により取得された前記データベースサーバのリソース使用量が、前記閾値記憶手段に記憶された所定の閾値を超えているかを判断する判断手段と、前記閾値記憶手段で記憶された所定の閾値を超えないリソース使用量で終了したデータベースサーバの実行計画を、前記入力されたSQL文と紐付けて記憶する正常時実行計画記憶手段と、前記判断手段で前記データベースサーバのリソース使用量が、前記閾値記憶手段に記憶された所定の閾値を超えている場合、前記実行計画受信手段で受信した実行計画と、前記正常時実行計画記憶手段で記憶した実行計画とを比較する比較手段と、前記比較手段による比較結果により、前記入力されたSQL文に紐付けられた前記正常時実行計画で該入力されたSQL文を処理するよう、前記データベースサーバに該正常時実行計画を送信する正常時実行計画送信手段とを有する。 The present invention is a database management device connectable to a database server, a transmission means for transmitting an inputted SQL sentence to the database server, a resource usage acquisition means for acquiring a resource usage of the database server, An execution plan receiving means for receiving an execution plan processed in response to the input SQL statement from the database server, and a threshold for storing a predetermined threshold for determining that the resource usage of the database server is abnormal A storage unit; a determination unit that determines whether the resource usage of the database server acquired by the resource usage acquisition unit exceeds a predetermined threshold stored in the threshold storage unit; and the threshold storage unit Execution of a database server terminated with a resource usage that does not exceed the stored threshold A normal execution plan storage unit that stores the image in association with the input SQL statement, and the resource usage of the database server exceeds the predetermined threshold stored in the threshold storage unit in the determination unit The execution plan received by the execution plan receiving means and a comparison means for comparing the execution plan stored in the normal execution plan storage means; A normal execution plan transmission means for transmitting the normal execution plan to the database server so as to process the inputted SQL statement in the associated normal execution plan.
本発明によれば、過去に正常な時間で処理された実行計画を記憶しておき、新たな実行計画により処理時間の遅延が生じた場合は、過去の正常な時間で処理した実行計画に戻して、少なくとも過去の正常な時間に近い処理時間で処理できる効果を有する。 According to the present invention, an execution plan processed in a normal time in the past is stored, and when a delay in processing time occurs due to a new execution plan, the execution plan processed in the past normal time is restored. Thus, there is an effect that processing can be performed in a processing time that is at least close to a past normal time.
以下、本発明の好ましい実施の形態について図面を参照しながら詳細に説明する。 Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings.
図1は、本発明に係るデータベース管理システムの構成を示すシステム構成図である。 FIG. 1 is a system configuration diagram showing the configuration of a database management system according to the present invention.
図1において、データベース管理システムは、少なくとも1つのデータベースサーバ102とSQL文を送信する管理用クライアント101、およびバッチ処理を管理し実行計画の適不適を判断するデータベース管理装置とがネットワークを介して接続されている。
In FIG. 1, the database management system connects at least one
管理ユーザは、管理用クライアント101からデータベース管理装置100にバッチ処理などを定義し、夜間などにバッチ処理を実行させる。
The management user defines batch processing and the like from the
データベース管理装置100は、管理ユーザからSQL文などのバッチ処理が入力され、そのSQL文をデータベースサーバ102に送信し、データベースサーバ102は、受信したSQL文などのバッチ処理を実行する。
The
夜間などにデータベースサーバ102で実行された処理結果は、翌朝などに一般ユーザがクライアント103などから取得する。
The processing result executed by the
なお、データベース管理装置100は、データベースサーバ102と同一の筐体でも良いし、また、管理用クライアント101と同一の筐体でも良い。また、データベース管理装置100とデータベースサーバ102と管理用クライアント101は同一の筐体としても良い。
The
図2は、本発明の実施形態の各種端末のハードウエア構成を示す図である。 FIG. 2 is a diagram showing a hardware configuration of various terminals according to the embodiment of the present invention.
図2において、CPU201は、システムバス204に接続される各デバイスを統括的に制御する。
In FIG. 2, the
また、ROM203あるいは外部メモリ211には、CPU201の制御プログラムであるオペレーティングシステム(OS)や、各サーバあるいは各クライアントの後述する各種機能を実現するためのプログラムが記憶されている。
The
RAM202は、CPU201の主メモリ、ワークエリア、一時待避領域等として機能する。
The
入力コントローラ205は、入力部209からの入力を制御する。この入力部209としては、特に、サーバやクライアント等の端末では、キーボード、マウス等のポインティングデバイスが挙げられる。また、印刷装置等では、タッチパネル、ボタン、スイッチ等が挙げられる。
The
出力コントローラ206は、出力部210の表示を制御する。この出力部210としては、例えば、CRTや液晶等が挙げられる。
The
外部メモリコントローラ207は、ブートプログラム、各種のアプリケーション、フォントデータ、ユーザーファイル、編集ファイル、プリンタドライバ等を記憶する外部メモリ211へのアクセスを制御する。加えて、各サーバあるいは各クライアントの各種機能を実現するための各種テーブル、パラメータが記憶されている。この外部メモリ211としては、ハードディスク(HD)やフロッピー(登録商標)ディスク(FD)、PCMCIAカードスロットにアダプタを介して接続されるコンパクトフラッシュ(登録商標)、スマートメディア等が挙げられる。
The
通信I/Fコントローラ208は、ネットワーク214を介して外部機器との通信制御処理を実行する。
The communication I /
本発明を実現するためのプログラム212は外部メモリ211に記録されており、必要に応じてRAM202にロードされることによりCPU201によって実行されるものである。
A
図3は、本発明の実施形態のデータベース管理システムのソフトウェア構成を示すブロック図である。 FIG. 3 is a block diagram showing a software configuration of the database management system according to the embodiment of this invention.
データベース管理装置100は、管理用クライアント101の入力部からバッチ処理を受信し、データベース管理装置100のバッチ処理部301はデータベースの実行計画管理部303へバッチ処理のSQL文を送信する。SQL文を受信した実行計画管理部303は、そのSQL文が遅延管理する対象のSQL文かどうかを判断する。
The
遅延管理する対象のSQL文である場合、SQL文をデータベースサーバ102に送信する。
If the SQL statement is a target of delay management, the SQL statement is transmitted to the
データベースサーバ102は、受信したSQL文から、データベース処理部321が最適と考える実行計画を選択し、実行SQL(第1の実行SQL:以後旧実行SQLと呼ぶ)を生成して、旧実行SQLを実行する。
The
旧実行SQLを開始すると、データベース管理装置100の実行計画管理部303は、旧実行SQL終了を条件として、データベースサーバ102のリソース情報(CPU処理時間、CPU使用率など)を取得し、それぞれのSQL文に対応した閾値をリソースが越えていないかを判断する。
When the old execution SQL is started, the execution
実行計画管理部303は、データベースサーバのリソースが閾値を越えている場合は、処理の遅延が発生していると考えられるので、遅延リカバリ処理へと移行する。
If the resource of the database server exceeds the threshold value, the execution
データベースサーバのリソースが閾値を越えないうちに処理を終えた場合は、旧実行SQLの実行計画をデータベースサーバ102から受信し、正常時の実行計画としてSQL文と紐付けて記憶しておく。
When the processing is completed before the resource of the database server exceeds the threshold value, the execution plan of the old execution SQL is received from the
一方、遅延リカバリ処理に移行すると、データベース管理装置100の実行計画管理部303は、SQL文に対応する正常時の実行計画を読み込み、また、データベースサーバ102から、旧実行SQLの実行計画を受信する。上記2つの実行計画を比較し、一致しているかどうかを判断する。
On the other hand, when the process proceeds to the delayed recovery process, the execution
上記判断が一致していない場合は、正常時の実行計画からヒント句を生成し、対象のSQL文にヒント句を付与した実行SQL(第2の実行SQL:以後新実行SQLと呼ぶ)を生成する。 If the above judgments do not match, a hint phrase is generated from the normal execution plan, and an execution SQL (second execution SQL: hereinafter referred to as a new execution SQL) with a hint phrase added to the target SQL statement is generated. To do.
次に、データベースサーバ102からリソース情報(CPU使用率やIOリソース使用率など)を取得し、現状のリソースの使用割合が大きい場合は、旧実行SQLを停止(ロールバックなど)し、新実行SQLを開始する。リソースの使用割合が大きい時に、新旧の実行SQLを同時に実行すると、処理がより遅くなるためである。
Next, resource information (CPU usage rate, IO resource usage rate, etc.) is acquired from the
また、生成した新実行SQLが更新系のSQL文(delete、update、insertなど)の場合にも、旧実行SQLを停止(ロールバックなど)し、新実行SQLを開始する。更新系のSQL文の場合、データのコンフリクトを防ぐため、多くのデータベースサーバは2つのSQLを同時に処理できない仕様になっているためである。 Also, when the generated new execution SQL is an update-type SQL statement (delete, update, insert, etc.), the old execution SQL is stopped (rollback, etc.), and the new execution SQL is started. This is because, in the case of an update SQL statement, in order to prevent data conflicts, many database servers have specifications that cannot process two SQLs simultaneously.
上記の条件に合致しない場合は、新旧の実行SQLを並行に起動し、早く終了した結果を取得して、該当のSQL文の処理を終える。 If the above conditions are not met, the new and old execution SQLs are started in parallel, the result of early termination is obtained, and the processing of the corresponding SQL statement is completed.
以上の処理により、実行計画の変更による処理時間の遅延が発生した場合、少なくとも過去の正常な時間に近い処理時間で処理することができる効果を有する。 As a result of the above processing, when a delay in processing time occurs due to a change in the execution plan, there is an effect that processing can be performed in at least processing time close to the past normal time.
以下、図4〜図7を参照して、本発明における実施形態の流れを説明する。 Hereinafter, the flow of the embodiment of the present invention will be described with reference to FIGS.
図4は、本発明の実施形態のデータベース管理システムにおける第1の制御処理手段の一例を示すフローチャートであり、図中のS401〜S411は各ステップを示す。各ステップの処理は、それぞれの装置の外部メモリ211に格納されたアプリケーションプログラムを、それぞれの装置のCPU201がRAM202上にロードして実行することにより実現される。
FIG. 4 is a flowchart showing an example of the first control processing unit in the database management system according to the embodiment of the present invention, and S401 to S411 in the figure indicate each step. The processing of each step is realized by the
図4のフローチャートは、データベース管理装置100がSQL文をデータベースサーバに送信しようとすると開始される処理の流れになる。
The flowchart in FIG. 4 is a flow of processing that is started when the
まず、ステップS401において、データベース管理装置100のバッチ処理部301は、実行命令を受け付けたSQL文を実行計画管理部303に送信する。
First, in step S <b> 401, the
次に、ステップS402において、データベース管理装置100の実行計画管理部303は、バッチ処理部301から受信したSQL文が遅延管理する対象のSQL文かどうかを判断する。この処理は、遅延管理しなくても良いSQL文(処理時間が明らかに短いSQL文など)での以降の処理を省くための判断分岐である。
Next, in step S <b> 402, the execution
実行計画管理部303に記憶されている遅延管理する対象のSQL文の例を図8を参照して説明する。
An example of an SQL statement to be managed for delay stored in the execution
図8は、本発明の実施形態のデータベース管理装置に記憶される遅延管理する対象のSQL文の一例を示すデータ構成である。 FIG. 8 is a data configuration showing an example of a SQL sentence to be delayed managed stored in the database management apparatus according to the embodiment of the present invention.
図8の801欄はSQL文毎に振られたSQLIDであり、802欄は遅延管理する対象のSQL文である。803は、パラメータの条件であり、803に記載のあるSQLIDのSQL文は、803に記載されたパラメータ条件が満たされている場合のみ、遅延管理する対象とする。図4のフローチャートの説明に戻る。
The
ステップS402で、実行計画管理部303は、受信したSQL文が遅延管理する対象のSQL文であれば、受信したSQL文をデータベースサーバ102へと送信し、ステップS403へと処理を移行する。一方、受信したSQL文が遅延管理する対象のSQL文でなければ、図5の処理に移行する。
In step S402, the execution
ステップS403に処理を移行すると、データベースサーバ102のデータベース処理部321は、受信したSQL文に適切と考えられる実行計画を適用して実行SQL(第1の実行SQL:以後旧実行SQLと呼ぶ)を生成し、旧実行SQLを実行する。
When the process proceeds to step S403, the
次に、実行計画管理部303は、定期的にデータベースサーバ102からリソース状況や処理時間などの情報を受信し(ステップS405)、閾値以上となって遅延していないかを確認する(ステップS406)。
Next, the execution
ステップS406における閾値の例を図9を参照して説明する。 An example of the threshold value in step S406 will be described with reference to FIG.
図9は、本発明の実施形態のデータベース管理装置に記憶されるSQLIDと遅延管理するリソースや処理時間の一例を示すデータ構成である。 FIG. 9 is a data configuration showing an example of SQLID stored in the database management apparatus according to the embodiment of the present invention, resources for delay management, and processing time.
図9の901欄はSQL文毎に振られたSQLIDであり、902欄は閾値のタイプを示す。閾値のタイプとしては、たとえば、該当SQLの処理時間の長さや、CPUの使用時間、使用割合、IOリソースの使用時間や使用割合などがある。903欄は、それぞれのタイプ毎の閾値であり、たとえば処理時間であれば100秒を超えた場合、CPUリソースであれば、使用割合が90%以上が1分以上続く場合などである。図4のフローチャートの説明に戻る。
The
ステップS405とステップS406の処理は、ステップS403で実行を開始した旧実行SQLが終了するまで繰り返す。 The processes in steps S405 and S406 are repeated until the old execution SQL started in step S403 is completed.
ステップS406で閾値以上となった場合は、遅延リカバリ処理へと処理を移行する。詳細は図6において説明する。 If it becomes equal to or greater than the threshold value in step S406, the process proceeds to the delay recovery process. Details will be described with reference to FIG.
ステップS406で閾値以上となることなく、ステップS403で実行した旧実行SQLが終了する(ステップS407)と、実行計画管理部303は、旧実行SQLの実行計画をデータベース処理部321から取得する(ステップS408、ステップS409)。
When the old execution SQL executed in step S403 ends without exceeding the threshold in step S406 (step S407), the execution
次に、ステップS410において、実行計画管理部は、取得した旧実行SQLの実行計画をステップS402で取得したSQL文と紐付けて記憶する。ステップS410でSQL文と紐付けて記憶する実行計画は、正常な状態で終了したと判断された実行計画である(以下、正常時の実行計画と呼ぶ)。正常な実行計画の例を図10を参照して説明する。 Next, in step S410, the execution plan management unit stores the acquired execution plan of the old execution SQL in association with the SQL statement acquired in step S402. The execution plan stored in association with the SQL statement in step S410 is an execution plan that is determined to have ended in a normal state (hereinafter referred to as a normal execution plan). An example of a normal execution plan will be described with reference to FIG.
図10は、本発明の実施形態のデータベース管理装置において、登録される実行計画の一例を示すデータ構成である。 FIG. 10 is a data configuration showing an example of an execution plan registered in the database management apparatus according to the embodiment of this invention.
図10の1001欄はSQL文毎に振られたSQLIDであり、図8のSQL文と対応付いている。1002欄はSQLIDそれぞれのSQL文における正常時の実行計画である。たとえば、SQLIDが1の「SELECT * FROM Aテーブル where ○○項目=:パラメタ1」というSQL文の場合、実行計画として「SELECT STATEMENT TABLE ACCESS Aテーブル INDEX A1インデックス UNIQUE SCAN」が登録されている。これは、SQLIDが1のSQL文であるAテーブルの検索には、A1インデックス(プライマリキー)による索引一意スキャンを行うと正常な時間以内に処理が終了することを意味する。また、SQLIDが2の「SELECT * FROM Aテーブル where ○○項目=:パラメタ1 and ××項目=:パラメタ2」というSQL文の場合、実行計画として「SELECT STATEMENT TABLE ACCESS Aテーブル INDEX A2インデックス RANGE SCAN」が登録されている。これは、SQLIDが2のSQL文であるAテーブルの検索には、A2インデックスによる索引レンジ・スキャンを行うと正常な時間以内に処理が終了することを意味する。図4のフローチャートの説明に戻る。
The
ステップS410において、SQL文と正常時の実行計画を紐付けてきおくすると、次にステップS411へと処理を移行する。 In step S410, if the SQL statement is linked to the normal execution plan, the process proceeds to step S411.
ステップS411において、バッチ処理部301は、S401で送信したSQL文の結果を取得し、引き続きの処理を行う。バッチ処理がSQL文である場合は、ステップS401へと処理を戻し、バッチ処理が終了するまでこの処理を繰り返す。
In step S411, the
以上の処理により、SQL文が正常に終了した際の実行計画を記憶することが出来る。 With the above processing, the execution plan when the SQL statement is normally completed can be stored.
つぎに、図5を参照して、実行計画管理部303が受信したSQL文が遅延管理する対象のSQL文でない場合の処理を説明する。
Next, processing when the SQL statement received by the execution
図5は、本発明の実施形態のデータベース管理システムにおける第2の制御処理手段の一例を示すフローチャートであり、それぞれの装置の外部メモリ211に格納されたアプリケーションプログラムを、それぞれの装置のCPU201がRAM202上にロードして実行することにより実現される。なお、図中のS501は処理ステップを示す。
FIG. 5 is a flowchart showing an example of the second control processing unit in the database management system according to the embodiment of the present invention. The application program stored in the external memory 211 of each device is stored in the
図5のフローチャートは、実行計画管理部303が受信したSQL文が遅延管理する対象のSQL文でない場合に開始される処理の流れになる。
The flowchart of FIG. 5 is a flow of processing that is started when the SQL statement received by the execution
ステップS501において、データベース処理部321は、実行計画管理部303からSQL文を受信し、受信したSQL文に対する実行計画を適用して実行SQLを生成し、実行SQLを実行する。
In step S501, the
データベース処理部321で実行した結果はバッチ処理部へ送信され、図4のステップS411へと処理へと移行する。
The result executed by the
以上、実行計画管理部303が受信したSQL文が遅延管理する対象のSQL文でない場合の処理の説明を終える。
This is the end of the description of the processing when the SQL statement received by the execution
次に、図6を参照して、データベースサーバ102の処理時間が遅延しているなどの場合の処理を説明する。
Next, with reference to FIG. 6, processing when the processing time of the
図6は、本発明の実施形態のデータベース管理システムにおける第3の制御処理手段の一例を示すフローチャートであり、それぞれの装置の外部メモリ211に格納されたアプリケーションプログラムを、それぞれの装置のCPU201がRAM202上にロードして実行することにより実現される。なお、図中のS601からS610は各処理ステップを示す。
FIG. 6 is a flowchart showing an example of the third control processing unit in the database management system according to the embodiment of the present invention. The application program stored in the external memory 211 of each device is stored in the
図6のフローチャートは、図4のステップS406において、データベースサーバ102の処理時間の遅延やデータベースサーバ102のリソースの高占有などが生じた際に開始される処理の流れになる。
The flowchart of FIG. 6 is a processing flow that is started when a delay in processing time of the
まず、ステップS601において、実行計画管理部303は、データベースサーバ102の処理時間の遅延やデータベースサーバ102のリソースの高占有などが生じている旧実行SQLを生成した際の実行計画を、データベース処理部321に要求する。
First, in step S601, the execution
次に、ステップS602において、データベース処理部321は、旧実行SQLを生成した際の実行計画を実行計画管理部303に送信する。
Next, in step S <b> 602, the
次に、ステップS603において、実行計画管理部303は、ステップS601の実行計画の要求により取得した実行計画を記憶する。また、ステップS410で過去に正常に終了した時の実行計画(正常時の実行計画)の内、ステップS402で受信したSQL文のテンプレート(図8の管理対象となるSQL一覧302の802欄)と同じ形式のSQLIDの実行計画(図10の1002欄)をSQL一覧(図8)と実行計画一覧(図10)から取得する。
Next, in step S603, the execution
次に、ステップS604において、実行計画管理部303は、ステップS602でデータベース処理部321から送信された旧実行SQLを生成した実行計画と、ステップS604で取得した正常時の実行計画とを比較する。
Next, in step S604, the execution
2つの実行計画が等しい場合は、この発明では解決できず、ステップS610へと処理を移行し、ステップS610において、旧実行SQLが終了するまで待機した後、ステップS411へと処理を移行する。 If the two execution plans are equal, the present invention cannot be solved, and the process proceeds to step S610. In step S610, the process waits until the old execution SQL is completed, and then proceeds to step S411.
一方、ステップS604において2つの実行計画が等しくない場合は、正常時の実行計画で処理速度を上げることが可能かもしれないので、正常時の実行計画を適用したSQL文を実行するため、次のステップS605の処理へと移行する。 On the other hand, if the two execution plans are not equal in step S604, it may be possible to increase the processing speed with the normal execution plan. Therefore, to execute the SQL statement to which the normal execution plan is applied, The process proceeds to step S605.
ステップS605へと処理を移行すると、実行計画管理部303は、ステップS603で取得した正常時の実行計画から正常時の実行計画を適用するためのヒント句を生成する。生成されるヒント句の例を図11を参照して説明する。
When the process proceeds to step S605, the execution
図11は、本発明の実施形態のデータベース管理装置において、ヒント句の作成された一例を示す図である。 FIG. 11 is a diagram illustrating an example in which a hint phrase is created in the database management apparatus according to the embodiment of this invention.
図11の1100は、図10の実行計画一覧のSQLIDそれぞれの実行計画に対するヒント句の例である。 11 is an example of a hint phrase for each execution plan of the SQLID in the execution plan list of FIG.
図11の1101の例では、SQLIDが1のSQL文に対して付与されるヒント句が生成された例であり、図10の1003の行を読み取って、A1インデックスによる検索を行うヒント句の例である。なお、索引一意スキャンを行う「INDEX UNIQUE SCAN」については、A1インデックスがプライマリキーであるので、記載は省略されている。図6のフローチャートの説明に戻る。
The example of 1101 in FIG. 11 is an example in which a hint phrase to be given to the SQL statement with
ステップS605において、正常時の実行計画からヒント句を生成すると、次のステップS606において、実行計画管理部303は、ステップS402で受信したSQL文に、ステップS605で生成されたヒント句を適用し、新たな実行SQLを作成する(第2の実行SQL:新実行SQLと呼ぶ)。作成される新実行SQLの例を、図12を参照して説明する。
When the hint phrase is generated from the normal execution plan in step S605, in the next step S606, the execution
図12は、本発明の実施形態のデータベース管理装置において、ヒント句を適用されて作成される新実行SQLの元になるSQL文の一例を示す図である。 FIG. 12 is a diagram illustrating an example of an SQL statement that is the basis of a new execution SQL created by applying a hint phrase in the database management apparatus according to the embodiment of this invention.
図12の1200には、ヒント句が付与される前、すなわちステップS402でバッチ処理部301から受信した段階のSQL文を示す。一方、1210は、図11の1101のヒント句が反映されたSQL文を示す。1201の「/*+ INDEX(A1インデックス) */」の欄が追記されており、このヒント句により、新実行SQLは、プライマリキーであるA1インデックスを使って検索することが出来る。図6のフローチャートの説明に戻る。
1200 in FIG. 12 shows the SQL sentence before the hint phrase is given, that is, at the stage received from the
ステップS606の処理を実行後、ステップS607において、実行計画管理部303は、ステップS402で受信したSQL文が更新系のSQLであるか、もしくは、ステップS405でデータベース処理部から送信されたリソースに使用割合が所定の割合を超えているかどうかを判断する。この判断分岐は、新実行SQLを旧実行SQLと並行して処理することが可能か、もしくはリソースの負荷が高くなるために並行して処理をしないほうが良いかの判断を行うための分岐である。
After executing the process of step S606, in step S607, the execution
ステップS402で受信したSQL文が更新系のSQLである場合は、並行して同じデータベースにアクセスすることが不可能であるため、ステップS608の処理へと移行する。 If the SQL sentence received in step S402 is an update-type SQL, it is impossible to access the same database in parallel, and the process proceeds to step S608.
ステップS608において、データベース処理部321は、旧実行SQLを切断し、次のステップS609で新実行SQLを開始する。新実行SQLが終了すると、図4のステップS411へと処理を移行する。
In step S608, the
また、ステップS607において、リソースの使用割合が所定の割合を超えて、リソースの使用負荷が高い場合も、ステップS608へと処理を移行する。ステップS608以降の処理は、上記と同じ処理となる。 Also, in step S607, when the resource usage rate exceeds a predetermined rate and the resource usage load is high, the process proceeds to step S608. The processing after step S608 is the same processing as described above.
ステップS607で、受信したSQL文が更新系ではなく、またリソースの使用負荷も所定の割合を超えていない場合、図7の新旧2つの実行SQLを並行して実行する処理に移行する。 In step S607, when the received SQL sentence is not an update system and the resource usage load does not exceed a predetermined ratio, the process proceeds to a process of executing the new and old execution SQLs of FIG. 7 in parallel.
図7を参照して、新旧2つの実行SQLを実行する処理について説明する。 With reference to FIG. 7, the process of executing the old and new execution SQL will be described.
図7は、本発明の実施形態のデータベース管理システムにおける第4の制御処理手段の一例を示すフローチャートであり、それぞれの装置の外部メモリ211に格納されたアプリケーションプログラムを、それぞれの装置のCPU201がRAM202上にロードして実行することにより実現される。なお、図中のS701からS708は各処理ステップを示す。
FIG. 7 is a flowchart showing an example of the fourth control processing unit in the database management system according to the embodiment of the present invention. The application program stored in the external memory 211 of each device is stored in the
図7のフローチャートは、図4のステップS406において、データベースサーバ102のリソースの占有率が所定の割合以下で、且つステップS402で受信したSQL文が更新系SQLではない場合に開始される処理の流れになる。
The flowchart of FIG. 7 shows the flow of processing started when the resource occupancy rate of the
まず、実行計画管理部303は、データベース処理部321へと処理を移行し、データベース処理部321は、2つの新旧実行SQLの処理を並行して処理する。
First, the execution
まず、旧実行SQLの処理はステップS701のように旧実行SQLを継続して実行する。 First, the old execution SQL process continues to execute the old execution SQL as in step S701.
また、新実行SQLの処理もステップS703において開始し、ステップS702もしくはステップS704において、どちらかの処理が終了するまで、ステップS701とステップS703の処理を繰り返す。 Also, the new execution SQL process is started in step S703, and the processes in steps S701 and S703 are repeated until either process is completed in step S702 or step S704.
ステップS702もしくはステップS704において、どちらかの処理が終了すると、処理を実行計画管理部303に移行する。
When either process ends in step S702 or step S704, the process proceeds to the execution
実行計画管理部303へと移行すると、ステップS705において、終了した実行SQLが新旧どちらのSQLかを判断し、終了していない方の実行SQLを切断し(ステップS706、S707)、図4のステップ411へと処理を移行する。
When the process proceeds to the execution
以上の処理により、本発明のデータベース管理装置は、新たな実行計画により処理時間の遅延が生じた場合は、過去の正常な時間で処理した実行計画に戻して、少なくとも過去の正常な時間に近い処理時間で処理できる効果を有する。 As a result of the above processing, the database management apparatus of the present invention returns to the execution plan processed at the normal time in the past when the processing time is delayed due to the new execution plan, and is at least close to the past normal time. It has the effect that it can process in processing time.
なお、本実施形態では、データベース管理装置100とデータベースサーバ102とが別筐体として記載したが、データベース管理装置100とデータベースサーバ102は一つの筐体としても良く、また複数の筐体からなっていても良い。
In the present embodiment, the
また、図8〜図10の各種データの構成およびその内容はこれに限定されるものではなく、用途や目的に応じて、様々な構成や内容で構成されることは言うまでもない。 Further, the configurations and contents of the various data in FIGS. 8 to 10 are not limited to this, and it is needless to say that they are configured with various configurations and contents according to applications and purposes.
以上、一実施形態について示したが、本発明は、例えば、システム、装置、方法、プログラムもしくは記録媒体等としての実施態様をとることが可能であり、具体的には、複数の機器から構成されるシステムに適用しても良いし、また、一つの機器からなる装置に適用しても良い。 Although one embodiment has been described above, the present invention can take an embodiment as, for example, a system, apparatus, method, program, or recording medium, and specifically includes a plurality of devices. The present invention may be applied to a system including a single device.
なお、本実施形態中に示した各変形例を組み合わせた構成も全て本発明に含まれるものである。 In addition, all the structures which combined each modification shown in this embodiment are also included in this invention.
以下、図13に示すメモリマップを参照して本発明に係るデータベース管理装置で読み取り可能なデータ処理プログラムの構成について説明する。 The configuration of the data processing program that can be read by the database management apparatus according to the present invention will be described below with reference to the memory map shown in FIG.
図13は、本発明に係るデータベース管理装置で読み取り(読み出し)可能な各種データ処理プログラムを格納する記録媒体(記憶媒体)のメモリマップを説明する図である。 FIG. 13 is a diagram illustrating a memory map of a recording medium (storage medium) that stores various data processing programs that can be read (read) by the database management apparatus according to the present invention.
なお、特に図示しないが、記録媒体に記憶されるプログラム群を管理する情報、例えばバージョン情報,作成者等も記憶され、かつ、プログラム読み出し側のOS等に依存する情報、例えばプログラムを識別表示するアイコン等も記憶される場合もある。 Although not specifically shown, information for managing a program group stored in the recording medium, for example, version information, creator, etc. is also stored, and information depending on the OS on the program reading side, for example, a program is identified and displayed. Icons may also be stored.
さらに、各種プログラムに従属するデータも上記ディレクトリに管理されている。また、インストールするプログラムやデータが圧縮されている場合に、解凍するプログラム等も記憶される場合もある。 Further, data depending on various programs is also managed in the directory. In addition, when a program or data to be installed is compressed, a program to be decompressed may be stored.
本実施形態における図4〜図7に示す機能が外部からインストールされるプログラムによって、ホストコンピュータにより遂行されていてもよい。そして、その場合、CD−ROMやフラッシュメモリやFD等の記録媒体により、あるいはネットワークを介して外部の記録媒体から、プログラムを含む情報群を出力装置に供給される場合でも本発明は適用されるものである。 The functions shown in FIGS. 4 to 7 in this embodiment may be performed by a host computer by a program installed from the outside. In this case, the present invention is applied even when an information group including a program is supplied to the output device from a recording medium such as a CD-ROM, a flash memory, or an FD, or from an external recording medium via a network. Is.
以上のように、前述した実施形態の機能を実現するソフトウェアのプログラムコードを記録した記録媒体を、システムあるいは装置に供給し、そのシステムあるいは装置のコンピュータ(またはCPUやMPU)が記録媒体に格納されたプログラムコードを読出し実行することによっても、本発明の目的が達成されることは言うまでもない。 As described above, a recording medium in which a program code of software for realizing the functions of the above-described embodiments is recorded is supplied to the system or apparatus, and the computer (or CPU or MPU) of the system or apparatus is stored in the recording medium. It goes without saying that the object of the present invention can also be achieved by reading and executing the program code.
この場合、記録媒体から読み出されたプログラムコード自体が本発明の新規な機能を実現することになり、そのプログラムコードを記憶した記録媒体は本発明を構成することになる。 In this case, the program code itself read from the recording medium realizes the novel function of the present invention, and the recording medium storing the program code constitutes the present invention.
プログラムコードを供給するための記録媒体としては、例えば、フレキシブルディスク,ハードディスク,光ディスク,光磁気ディスク,CD−ROM,CD−R,DVD−ROM,磁気テープ,不揮発性のメモリカード,ROM,EEPROM,シリコンディスク等を用いることができる。 As a recording medium for supplying the program code, for example, a flexible disk, hard disk, optical disk, magneto-optical disk, CD-ROM, CD-R, DVD-ROM, magnetic tape, nonvolatile memory card, ROM, EEPROM, A silicon disk or the like can be used.
また、コンピュータが読み出したプログラムコードを実行することにより、前述した実施形態の機能が実現されるだけでなく、そのプログラムコードの指示に基づき、コンピュータ上で稼働しているOS(オペレーティングシステム)等が実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。 Further, by executing the program code read by the computer, not only the functions of the above-described embodiments are realized, but also an OS (operating system) or the like running on the computer based on the instruction of the program code. It goes without saying that a case where the function of the above-described embodiment is realized by performing part or all of the actual processing and the processing is included.
さらに、記録媒体から読み出されたプログラムコードが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれた後、そのプログラムコードの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPU等が実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。 Furthermore, after the program code read from the recording medium is written in a memory provided in a function expansion board inserted in the computer or a function expansion unit connected to the computer, the function expansion is performed based on the instruction of the program code. It goes without saying that the case where the CPU or the like provided in the board or the function expansion unit performs part or all of the actual processing and the functions of the above-described embodiments are realized by the processing.
また、本発明は、複数の機器から構成されるシステムに適用しても、1つの機器からなる装置に適用してもよい。また、本発明は、システムあるいは装置にプログラムを供給することによって達成される場合にも適応できることは言うまでもない。この場合、本発明を達成するためのソフトウェアによって表されるプログラムを格納した記録媒体を該システムあるいは装置に読み出すことによって、そのシステムあるいは装置が、本発明の効果を享受することが可能となる。 Further, the present invention may be applied to a system composed of a plurality of devices or an apparatus composed of a single device. Needless to say, the present invention can be applied to a case where the present invention is achieved by supplying a program to a system or apparatus. In this case, by reading a recording medium storing a program represented by software for achieving the present invention into the system or apparatus, the system or apparatus can enjoy the effects of the present invention.
さらに、本発明を達成するためのソフトウェアによって表されるプログラムをネットワーク上のサーバ,データベース等から通信プログラムによりダウンロードして読み出すことによって、そのシステムあるいは装置が、本発明の効果を享受することが可能となる。 Furthermore, by downloading and reading out a program represented by software for achieving the present invention from a server, database, etc. on a network using a communication program, the system or apparatus can enjoy the effects of the present invention. It becomes.
100 データベース管理装置
101 管理用クライアント
102 データベースサーバ
103 クライアント
100
Claims (8)
入力されたSQL文を前記データベースサーバに送信する送信手段と、
前記データベースサーバのリソース使用量を取得するリソース使用量取得手段と、
前記データベースサーバから、前記入力されたSQL文に対応して処理される実行計画を受信する実行計画受信手段と、
前記データベースサーバのリソース使用量が異常であると判断する所定の閾値を記憶する閾値記憶手段と、
前記リソース使用量取得手段により取得された前記データベースサーバのリソース使用量が、前記閾値記憶手段に記憶された所定の閾値を超えているかを判断する判断手段と、
前記閾値記憶手段で記憶された所定の閾値を超えないリソース使用量で終了したデータベースサーバの実行計画を、前記入力されたSQL文と紐付けて記憶する正常時実行計画記憶手段と、
前記判断手段で前記データベースサーバのリソース使用量が、前記閾値記憶手段に記憶された所定の閾値を超えている場合、前記実行計画受信手段で受信した実行計画と、前記正常時実行計画記憶手段で記憶した実行計画とを比較する比較手段と、
前記比較手段による比較結果により、前記入力されたSQL文に紐付けられた前記正常時実行計画で該入力されたSQL文を処理するよう、前記データベースサーバに該正常時実行計画を送信する正常時実行計画送信手段と
を有することを特徴とするデータベース管理装置。 A database management device that can be connected to a database server,
Transmitting means for transmitting the input SQL sentence to the database server;
Resource usage acquisition means for acquiring the resource usage of the database server;
Execution plan receiving means for receiving an execution plan processed in response to the input SQL statement from the database server;
Threshold storage means for storing a predetermined threshold for determining that the resource usage of the database server is abnormal;
Determining means for determining whether the resource usage of the database server acquired by the resource usage acquiring means exceeds a predetermined threshold stored in the threshold storage;
A normal-time execution plan storage unit that stores an execution plan of a database server that is terminated with a resource usage amount that does not exceed the predetermined threshold stored in the threshold storage unit, in association with the input SQL statement;
When the resource usage of the database server by the determination means exceeds a predetermined threshold stored in the threshold storage means, the execution plan received by the execution plan reception means and the normal execution plan storage means A comparison means for comparing the stored execution plan;
When the normal execution plan is transmitted to the database server so that the input SQL statement is processed by the normal execution plan associated with the input SQL statement based on the comparison result by the comparing means. A database management apparatus comprising execution plan transmission means.
前記入力されたSQL文に対応する The database management apparatus according to claim 1, wherein the threshold value storage unit has a different threshold value for each of the input SQL sentences.
Corresponds to the input SQL sentence
入力されたSQL文を前記データベースサーバに送信する送信ステップと、
前記データベースサーバのリソース使用量を取得するリソース使用量取得ステップと
前記データベースサーバから、前記入力されたSQL文に対応して処理される実行計画を受信する実行計画受信ステップと、
前記リソース使用量取得ステップにより取得された前記データベースサーバのリソース使用量が、前記閾値記憶手段に記憶された所定の閾値を超えているかを判断する判断ステップと、
前記閾値記憶手段で記憶された所定の閾値を超えないリソース使用量で終了したデータベースサーバの実行計画を、前記入力されたSQL文と紐付けて登録する正常時実行計画登録ステップと、
前記判断ステップで前記データベースサーバのリソース使用量が、前記閾値記憶手段に記憶された所定の閾値を超えている場合、前記実行計画受信ステップで受信した実行計画と、前記正常時実行計画登録ステップで登録した実行計画とを比較する比較ステップと、
前記比較ステップによる比較結果により、前記入力されたSQL文に紐付けられた前記正常時実行計画で該入力されたSQL文を処理するよう、前記データベースサーバに該正常時実行計画を送信する正常時実行計画送信ステップと
を有することを特徴とするデータベース管理装置 A database management method in a database management apparatus having threshold storage means for storing a predetermined threshold for determining that the resource usage of the database server is abnormal and connectable to the database server,
A transmission step of transmitting the input SQL sentence to the database server;
A resource usage acquisition step of acquiring the resource usage of the database server; and an execution plan reception step of receiving an execution plan processed in response to the input SQL statement from the database server;
A determination step of determining whether the resource usage of the database server acquired by the resource usage acquisition step exceeds a predetermined threshold stored in the threshold storage means;
A normal time execution plan registration step of registering an execution plan of a database server terminated with a resource usage amount not exceeding a predetermined threshold stored in the threshold storage unit in association with the input SQL statement;
If the resource usage of the database server in the determining step exceeds a predetermined threshold stored in the threshold storage means, the execution plan received in the execution plan receiving step and the normal execution plan registration step A comparison step that compares the created execution plan with
When the normal execution plan is transmitted to the database server so as to process the input SQL statement with the normal execution plan associated with the input SQL statement, based on the comparison result of the comparison step. A database management apparatus comprising: an execution plan transmission step;
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014127831A JP2016009225A (en) | 2014-06-23 | 2014-06-23 | Database management device, database management method, program, and recording medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014127831A JP2016009225A (en) | 2014-06-23 | 2014-06-23 | Database management device, database management method, program, and recording medium |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2016009225A true JP2016009225A (en) | 2016-01-18 |
Family
ID=55226761
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014127831A Pending JP2016009225A (en) | 2014-06-23 | 2014-06-23 | Database management device, database management method, program, and recording medium |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2016009225A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106682101A (en) * | 2016-12-05 | 2017-05-17 | 福建天晴数码有限公司 | Method and system for detecting operation anomalies of database script |
KR20190054741A (en) * | 2017-11-14 | 2019-05-22 | 주식회사 케이티 | Method and Apparatus for Quality Management of Data |
-
2014
- 2014-06-23 JP JP2014127831A patent/JP2016009225A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106682101A (en) * | 2016-12-05 | 2017-05-17 | 福建天晴数码有限公司 | Method and system for detecting operation anomalies of database script |
CN106682101B (en) * | 2016-12-05 | 2019-09-20 | 福建天晴数码有限公司 | A kind of database script is operating abnormally the method and system of detection |
KR20190054741A (en) * | 2017-11-14 | 2019-05-22 | 주식회사 케이티 | Method and Apparatus for Quality Management of Data |
KR102507837B1 (en) | 2017-11-14 | 2023-03-07 | 주식회사 케이티 | Method and Apparatus for Quality Management of Data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101650660B (en) | Booting a computer system from central storage | |
KR101760778B1 (en) | Computer system and method for updating program therein | |
US20130198730A1 (en) | Update systems responsive to ongoing processing at a storage system | |
US20150227605A1 (en) | Information processing terminal, synchronization control method, and computer-readable recording medium | |
EP3598301A1 (en) | Cloud management platform, virtual machine management method, system thereof | |
US10956383B2 (en) | Device backup and wipe | |
EP3267323A1 (en) | Thin client system, connection management device, virtual machine operating device, method, and storage medium | |
CN113961510B (en) | File processing method, device, equipment and storage medium | |
CN102272751A (en) | Data integrity in a database environment through background synchronization | |
CN108475201A (en) | A kind of data capture method in virtual machine start-up course and cloud computing system | |
CN108111598B (en) | Cloud disk data issuing method and device and storage medium | |
CN104517067A (en) | Method, device and system for data access | |
US20160173714A1 (en) | Information processing apparatus, method of controlling the same, and storage medium | |
JP2016009225A (en) | Database management device, database management method, program, and recording medium | |
CN111031126B (en) | Cluster cache sharing method, system, equipment and storage medium | |
CN110096295B (en) | Multi-module mobile application thermal updating method and system based on reactivating | |
CN111124256B (en) | Method, apparatus and computer program product for managing storage | |
CN111274192A (en) | Multi-BMC management system and blade server | |
US8219527B2 (en) | File processing apparatus, file processing method, and computer program product | |
CN111708288B (en) | Data processing method and device, electronic equipment and storage medium | |
CN114722003A (en) | Centralized data acquisition method, device, equipment and storage medium | |
CN114328026A (en) | Virtual disk backup method, device, equipment and medium | |
KR101298852B1 (en) | Method of restoring file and system for the same | |
US9727378B2 (en) | Persistent unenrollment for devices under management | |
CN113076273B (en) | Component access method, device, electronic equipment, storage medium and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD03 | Notification of appointment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7423 Effective date: 20161101 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20161101 |