JP2018124658A - Information processing device, program and information processing method - Google Patents
Information processing device, program and information processing method Download PDFInfo
- Publication number
- JP2018124658A JP2018124658A JP2017014518A JP2017014518A JP2018124658A JP 2018124658 A JP2018124658 A JP 2018124658A JP 2017014518 A JP2017014518 A JP 2017014518A JP 2017014518 A JP2017014518 A JP 2017014518A JP 2018124658 A JP2018124658 A JP 2018124658A
- Authority
- JP
- Japan
- Prior art keywords
- query
- execution
- progress
- scan
- server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は情報処理装置、プログラムおよび情報処理方法に関する。 The present invention relates to an information processing apparatus, a program, and an information processing method.
情報処理の分野では、処理対象となるデータの規模が増している。処理対象のデータが大規模化すると、コンピュータなどによるデータ処理の時間が増す。そこで、データ処理を高速に行う方法が考えられている。 In the field of information processing, the scale of data to be processed is increasing. When the data to be processed becomes large, the time for data processing by a computer or the like increases. Therefore, a method of performing data processing at high speed has been considered.
例えば、マルチデータベースシステム(MDBS:Multi DataBase System)において、データ検索における照会応答時間を短縮する方法の提案がある。この提案では、MDBSは、複数の地点に存在する複数のデータベースに対する大域的なアクセスを可能にする。MDBSは、各地に点在する複数のテーブルに対する複数の結合演算を含む照会ツリーを、各結合演算を並列化できるように変換する。MDBSは、変換後のツリーによりデータ照会のうち複数の結合演算を並列に実行することで、照会応答時間を短縮する。 For example, in a multi-database system (MDBS: Multi DataBase System), there is a proposal of a method for reducing a query response time in data search. In this proposal, MDBS allows global access to multiple databases residing at multiple locations. The MDBS converts a query tree including a plurality of join operations for a plurality of tables scattered in various places so that each join operation can be parallelized. The MDBS shortens the query response time by executing a plurality of join operations among the data queries in parallel by the converted tree.
ところで、制御用の装置が、2つの装置それぞれにデータ処理に関するクエリ(処理命令の集合)を実行させ、早く実行を完了した方の実行結果を採用することで、応答時間の短縮を図ることも考えられる。 By the way, the control device causes each of the two devices to execute a query related to data processing (a set of processing instructions), and adopts the execution result of which the execution is completed earlier, thereby shortening the response time. Conceivable.
この場合、一方の装置で実行結果が得られると、他方の装置による処理は余計になる。そこで、実行結果が得られた後に、他方の装置による処理の実行を停止させることが考えられる。しかし、この方法では、一方の装置で実行結果が得られるまで、他方の装置で当該処理のためにリソースが使用され続けるという問題がある。 In this case, if an execution result is obtained by one device, the processing by the other device becomes unnecessary. Therefore, it is conceivable to stop execution of processing by the other device after the execution result is obtained. However, this method has a problem in that resources are continuously used for the processing in the other device until an execution result is obtained in one device.
1つの側面では、本発明は、リソースが使用される期間を短縮可能にすることを目的とする。 In one aspect, the present invention aims to make it possible to shorten the period during which resources are used.
1つの態様では、情報処理装置が提供される。情報処理装置は、記憶部と処理部とを有する。記憶部は、クエリに含まれる複数の処理による処理対象のデータを記憶する。処理部は、記憶部に記憶されたデータに基づいて複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定し、第1の装置および第2の装置の両方にクエリの実行開始を指示し、第1の装置により実行される監視対象処理の第1の進捗情報を取得し、第2の装置により実行される監視対象処理の第2の進捗情報を取得し、第1の進捗情報および第2の進捗情報に基づいて、第1の装置および第2の装置のうちの1の装置にクエリの実行停止を指示する。 In one aspect, an information processing apparatus is provided. The information processing apparatus includes a storage unit and a processing unit. The storage unit stores data to be processed by a plurality of processes included in the query. The processing unit determines a monitoring target process in which the processing load is estimated to be larger than a predetermined load among the plurality of processes based on the data stored in the storage unit, and both the first device and the second device To start execution of the query, obtain first progress information of the monitoring target process executed by the first device, and obtain second progress information of the monitoring target processing executed by the second device Based on the first progress information and the second progress information, one of the first device and the second device is instructed to stop execution of the query.
1つの側面では、リソースが使用される期間を短縮できる。 In one aspect, the period during which resources are used can be shortened.
以下、本実施の形態について図面を参照して説明する。
[第1の実施の形態]
図1は、第1の実施の形態の情報処理装置を示す図である。情報処理装置1は、第1の装置2、第2の装置3、端末装置4および記憶装置5とネットワーク6を介して接続されている。情報処理装置1は、端末装置4によるクエリQ1の入力を受け付ける。「クエリ」は、データに対する処理内容を示す命令の集合である。このため、クエリは、複数の命令に対応する複数の処理を含むといえる。「クエリ」は、「処理の要求」、「照会の要求」あるいは「問い合わせの要求」などと表すこともできる。
Hereinafter, the present embodiment will be described with reference to the drawings.
[First Embodiment]
FIG. 1 is a diagram illustrating the information processing apparatus according to the first embodiment. The
情報処理装置1は、第1の装置2および第2の装置3の両方に、クエリQ1を実行させる。情報処理装置1は、第1の装置2および第2の装置3のうち、早く実行完了した方の実行結果を採用する。
The
ここで、例えば、両装置のハードウェア構成やソフトウェア構成の相違は、処理の速さに影響を及ぼし得る。第1の装置2が第1の種類のデータ処理を第2の装置3よりも高速に実行することもあれば、第2の装置3が第2の種類のデータ処理を第1の装置2よりも高速に実行することもある。しかし、あるクエリを両装置の何れの方が高速に実行できるかを事前に判断することは難しい。このため、情報処理装置1は、第1の装置2および第2の装置3の両方にクエリQ1を実行させた上で、早く実行完了した方から実行結果を取得し、端末装置4に応答する。このような運用において、情報処理装置1は、第1の装置2および第2の装置3によるリソース利用の効率化を図る機能を提供する。情報処理装置1は、記憶部1aおよび処理部1bを有する。
Here, for example, a difference in hardware configuration or software configuration between the two apparatuses may affect the processing speed. The
記憶部1aは、RAM(Random Access Memory)などの揮発性記憶装置でもよいし、HDD(Hard Disk Drive)やフラッシュメモリなどの不揮発性記憶装置でもよい。処理部1bは、CPU(Central Processing Unit)、DSP(Digital Signal Processor)、ASIC(Application Specific Integrated Circuit)、FPGA(Field Programmable Gate Array)などを含み得る。処理部1bはプログラムを実行するプロセッサであってもよい。ここでいう「プロセッサ」には、複数のプロセッサの集合(マルチプロセッサ)も含まれ得る。
The
記憶部1aは、クエリQ1に含まれる複数の処理による処理対象のデータ(処理対象データ)D1を記憶する。例えば、クエリQ1は、処理proc1,proc2,proc3,proc4,・・・を含む。また、処理対象データD1は、データセットd1,d2,d3を含む。処理proc1は、データセットd1に対する処理である。処理proc2は、データセットd2に対する処理である。処理proc3は、データセットd3に対する処理である。例えば、処理対象データD1は、記憶装置5に記憶されたデータの母集団の一部でもよい。
The
処理部1bは、端末装置4によるクエリQ1の入力を受け付ける。処理部1bは、記憶部1aに記憶されたデータ(処理対象データD1)に基づいて、クエリQ1に含まれる複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定する。監視対象処理は、1つでもよいし、複数でもよい。また、処理部1bは、受け付けたクエリQ1に基づいて、クエリQ1に複数の処理により用いられる処理対象データD1を特定し、処理対象データD1を記憶装置5から取得し、記憶部1aに格納してもよい。
The
ここで、「処理負荷」は、該当の処理を実行する装置に与える負荷を意味する。例えば、処理部1bは、複数の処理それぞれの演算コストを、複数の処理それぞれの処理負荷とすることが考えられる。処理部1bは、処理対象となるデータセットに対する演算のステップ数やステップ数に対応する指標などにより、各処理の演算コストを評価し得る。より具体的には、処理部1bは、データセットに含まれるレコード数などの情報量を演算コストとしてもよい。処理対象となる情報量が増すほど、演算コストも増す可能性が高いからである。なお、「レコード」は、データセットに属する情報の単位であり、例えば、データセットがテーブルの場合、テーブルの1行に相当する。
Here, “processing load” means a load applied to a device that executes the corresponding process. For example, the
一例では、「所定の負荷」は、レコード数の閾値によって定められる。処理部1bは、データセットd1,d2,d3それぞれのレコード数を閾値と比較する。ここでは、データセットd1のレコード数は、閾値より大きい。データセットd2のレコード数は、閾値より大きい。データセットd3のレコード数は、閾値より小さい。この場合、処理部1bは、データセットd1を用いる処理proc1、および、データセットd2を用いる処理proc2を、監視対象処理と決定する。
In one example, the “predetermined load” is determined by a threshold for the number of records. The
処理部1bは、第1の装置2および第2の装置3の両方にクエリQ1の実行開始を指示する。例えば、処理部1bは、クエリQ1の実行開始を指示する所定の命令を、第1の装置2および第2の装置3の両方に送信することで、クエリQ1の実行開始を指示する。
The
第1の装置2は、実行開始の指示を受け付けると、クエリQ1の実行を開始する。第2の装置3は、実行開始の指示を受け付けると、クエリQ1の実行を開始する。クエリQ1に含まれる複数の処理それぞれは、第1の装置2および第2の装置3それぞれにより個別に実行される。なお、処理部1bは、第1の装置2および第2の装置3に、処理対象データD1を提供してもよい。
When the
処理部1bは、第1の装置2により実行される監視対象処理の第1の進捗情報を取得する。また、処理部1bは、第2の装置3により実行される監視対象処理の第2の進捗情報を取得する。ここで、進捗情報は、例えば、監視対象処理の進捗率を示す。一例では、進捗率は、監視対象処理により用いられるデータセットの全レコード数Nおよび処理済レコード数nに対し、n/N×100(%)である。
The
例えば、処理部1bは、監視対象処理の進捗を第1の装置2に問い合わせることで、第1の進捗情報を取得してもよい。あるいは、処理部1bは、第1の装置2による監視対象処理の進捗に応じて、監視対象処理で用いられるデータセットに含まれるレコードを、順番に、第1の装置2に提供することも考えられる。この場合、処理部1bは、第1の装置2に対するレコードの提供状況から第1の進捗情報を取得してもよい。同様に、処理部1bは、第2の装置3へ問い合わせることで第2の進捗情報を取得する。または、処理部1bは、第2の装置3に対するレコードの提供状況から第2の進捗情報を取得してもよい。
For example, the
そして、処理部1bは、第1の進捗情報および第2の進捗情報に基づいて、第1の装置2および第2の装置3のうちの1の装置にクエリQ1の実行停止を指示する。例えば、処理部1bは、第1の進捗情報および第2の進捗情報に基づいて、一方の装置で全ての監視対象処理の進捗率が100%に達したか否かを判定する。処理部1bは、一方の装置で全ての監視対象処理の進捗率が100%に達したと判定すると、他方の装置に対して、クエリQ1の実行停止を指示する。また、処理部1bは、一方の装置で全ての監視対象処理の進捗率が100%に達していないと判定すると、両方の装置によるクエリQ1の実行を継続させる。なお、「全ての監視対象処理の進捗率が100%に達したこと」は、「全ての監視対象処理の実行が完了したこと」ともいえる。また、例えば、処理部1bは、クエリQ1の実行停止を指示する所定の命令を、第1の装置2および第2の装置3のうちの1の装置に送信することで、当該1の装置に、クエリQ1の実行停止を指示する。
Then, the
監視対象処理が処理proc1,proc2の場合の制御例は次の通りである。なお、以下の説明で「時刻」という場合、ある程度(微小な)幅のある時間範囲を表すと考えてもよい。図1下部の制御例では、左側から右側へ向かう方向が時間軸の正方向である。 A control example when the monitoring target process is the process proc1, proc2 is as follows. In the following description, the term “time” may be considered to represent a time range having a certain (minute) width. In the control example at the bottom of FIG. 1, the direction from the left side to the right side is the positive direction of the time axis.
時刻T1において、処理部1bは、第1の装置2および第2の装置3の両方に、クエリQ1の実行開始を指示する。時刻T1以降、処理部1bは、監視対象処理proc1,proc2それぞれについて第1の進捗情報を、定期的に取得する。また、処理部1bは、監視対象処理proc1,proc2それぞれについて第2の進捗情報を、定期的に取得する。例えば、処理部1bは、第1の進捗情報および第2の進捗情報を定期的に取得するたびに、第1の進捗情報および第2の進捗情報に基づいて、クエリQ1の実行に関する停止判定を行う。停止判定の条件は、前述の「一方の装置で全ての監視対象処理が実行完了されたこと」である。
At time T1, the
時刻T2において、処理部1bは、第1の装置2による処理proc1の第1の進捗情報(aとする)、および、第1の装置2による処理proc2の第1の進捗情報(bとする)を取得する。例えば、a=50%であり、b=100%であるとする。また、時刻T2において、処理部1bは、第2の装置3による処理proc1の第1の進捗情報(cとする)、および、第2の装置3による処理proc2の第2の進捗情報(dとする)を取得する。例えば、c=100%であり、d=100%であるとする。
At time T2, the
処理部1bは、第1の進捗情報(a,b)および第2の進捗情報(c,d)に基づいて停止判定を行う。この場合、処理部1bは、第2の装置3において、全ての監視対象処理の進捗率が100%に達したと判定する。このため、処理部1bは、クエリQ1の実行停止を第1の装置2に指示する。
The
第1の装置2は、クエリQ1の実行停止の指示を受け付けると、クエリQ1の実行を停止する。一方、第2の装置3は、クエリQ1の実行を継続する。
時刻T3において、第2の装置3は、クエリQ1の実行を完了する。第2の装置3は、クエリQ1の実行を完了したことを、処理部1bに通知する。処理部1bは、第2の装置3からクエリQ1の実行結果を取得する。処理部1bは、クエリQ1の実行結果を端末装置4に送信する。そして、端末装置4は、クエリQ1の実行結果を受信する。
When receiving an instruction to stop execution of query Q1,
At time T3, the
ここで、上記の例において、処理部1bによる停止判定を行わずに、第1の装置2によるクエリQ1の実行を継続させることを考える。この場合、第1の装置2によるクエリQ1の実行が完了する時刻は、時刻T3よりも後の時刻である可能性が高いと推定される。理由は次の通りである。
Here, in the above example, it is considered that the execution of the query Q1 by the
クエリQ1の総実行所要時間に占める各処理の実行所要時間の割合は、処理負荷(演算コスト)の大きな処理ほど、大きいと考えられる。すなわち、上記の例の場合、処理proc1,proc2それぞれの実行所要時間の割合は、処理proc3の実行所要時間の割合に比べて大きい。この関係性は第1の装置2および第2の装置3に対して共通である。このため、処理proc1,proc2の両方または一方(上記例では処理proc1)の実行完了が遅延している第1の装置2では、クエリQ1の総実行所要時間が、第2の装置3よりも長い可能性が高いと推定される。よって、第1の装置2によるクエリQ1の実行が完了する時刻は、時刻T3よりも後の時刻である可能性が高いと推定される。
The ratio of the time required for executing each process to the total time required for executing the query Q1 is considered to be larger as the process with a higher processing load (calculation cost). That is, in the case of the above example, the ratio of the required execution times of the processes proc1 and proc2 is larger than the ratio of the required execution times of the process proc3. This relationship is common to the
このような分析結果によれば、時刻T2以降も第1の装置2によるクエリQ1の実行を継続することは非効率的である。特に、第2の装置3によるクエリQ1の実行結果を得られた後に(時刻T3以後に)、第1の装置2によるクエリQ1の実行を停止させるのでは遅過ぎる。第1の装置2により、クエリQ1の処理実行のためにリソースが余計に利用され、第1の装置2を別の処理に活用する機会が減るし、また、第1の装置2による余計なリソース利用により、余計な電力消費も発生するからである。そこで、処理部1bは、時刻T2において第1の装置2によるクエリQ1の実行を停止させる。
According to such an analysis result, it is inefficient to continue the execution of the query Q1 by the
これにより、第1の装置2においてクエリQ1の処理のためにリソースが利用される期間を短縮できる。図1の例でいえば、第1の装置2によるクエリQ1の実行を時刻T3に停止させる場合に比べて、時間差ΔT=T3−T2の分だけ、第1の装置2におけるクエリQ1の処理のためのリソースの利用期間を短縮できることになる。その結果、第1の装置2の空いたリソースを別の処理に活用可能となる。また、クエリQ1の実行に伴う第1の装置2の電力消費を低減できる。
As a result, the period during which resources are used for processing the query Q1 in the
図1の例では、処理部1bにより、第1の装置2によるクエリQ1の実行を停止させる例を示したが、別のクエリでは、逆に、第2の装置3によるクエリの実行を停止させ、第1の装置2による当該クエリの実行を継続させることもある。この場合、第2の装置3による余計なリソース利用の期間を短縮できることになる。
In the example of FIG. 1, the example in which the
こうして、第1の装置2および第2の装置3のリソースを効率的に利用可能となる。
なお、処理部1bは、クエリQ1に含まれる複数の処理のうち、初期段階に実行され得る幾つかの処理を抽出し、初期段階に実行され得る幾つかの処理の中から、監視対象処理を決定してもよい。例えば、処理部1bは、クエリQ1の構文から、クエリQ1に含まれる複数の処理のうち、第1の処理よりも早く実行される第2の処理を特定し、第2の処理を監視対象処理と決定してもよい。より具体的には、クエリQ1がデータベースに対する問い合わせを記述したSQL(Structured Query Language)文である場合が考えられる。この場合、処理部1bは、クエリQ1により示される一連の処理の初期に行われる複数のテーブルスキャンを、SQL文の構文を基に特定し、複数のテーブルスキャンの中から監視対象処理を特定してもよい。このようにすれば、一方の装置によるクエリQ1の実行停止を一層早めることができる。
Thus, the resources of the
The
また、記憶部1aおよび処理部1bの機能は、第1の装置2(または第2の装置3)に設けられてもよい。すなわち、第1の装置2(または第2の装置3)が情報処理装置1と同じ機能を有してもよい。情報処理装置1と第1の装置2とが同一の装置であってもよい)。あるいは、情報処理装置1と第2の装置3とが同一の装置であってもよい。また、第1の装置2(または第2の装置3)は、複数の他の装置を用いて、クエリQ1の処理を分散して実行するものでもよい。
The functions of the
以下では、関係データベース(RDB:Relational DataBase)に対する問い合わせを実行するデータベース管理システム(DBMS:DataBase Management System)を例示することで、情報処理装置1の機能を更に具体的に説明する。
Hereinafter, the function of the
[第2の実施の形態]
図2は、第2の実施の形態の情報処理システムの例を示す図である。第2の実施の形態の情報処理システムは、データベース(DB:DataBase)サーバ100、マスタサーバ200、スレーブサーバ300,400,500およびクライアント600を含む。DBサーバ100、クライアント600は、ネットワーク10に接続されている。
[Second Embodiment]
FIG. 2 is a diagram illustrating an example of an information processing system according to the second embodiment. The information processing system according to the second embodiment includes a database (DB)
マスタサーバ200およびスレーブサーバ300,400,500は、クラスタ20を形成する。クラスタ20は、ネットワーク21を含む。マスタサーバ200およびスレーブサーバ300,400,500は、ネットワーク21に接続されている。また、ネットワーク21は、ネットワーク10と接続される。ネットワーク10,21は、例えば、LAN(Local Area Network)である。
The
DBサーバ100は、DBMSの機能を有するサーバコンピュータである。DBサーバ100は、DBに対する問い合わせ内容を示すクエリをクライアント600から受信し、クエリに応じた処理をDBに対して実行する。DBサーバ100は、問い合わせに対する応答として、処理の実行結果を、クライアント600に応答する。DBサーバ100は、ストレージ30に接続されている。ストレージ30は、HDDやSSD(Solid State Drive)などの複数の記憶装置を備え、複数の記憶装置を用いてDBを記憶する。ストレージ30は、DBサーバ100に(直接またはネットワークを介して)外付けされてもよいし、DBサーバ100に内蔵されてもよい。
The
クラスタ20は、DBサーバ100とともにDBアクセスに利用されるサブシステムである。クラスタ20のうちマスタサーバ200は、DBサーバ100からクエリの実行指示およびクエリに応じた処理対象のデータを受信し、スレーブサーバ300,400,500に処理を割り振る。スレーブサーバ300,400,500は、マスタサーバ200により割り振られた処理を実行し、実行結果をマスタサーバ200に送信する。マスタサーバ200は、スレーブサーバ300,400,500それぞれから実行結果を受信し、複数の実行結果をマージし、マージ後の実行結果を、DBサーバ100に送信する。
The
クライアント600は、ユーザにより利用されるクライアントコンピュータである。クライアント600は、ユーザによるクエリの入力を受け付け、入力されたクエリをDBサーバ100に送信する。ユーザは、SQLを用いてクライアント600にクエリを入力する。クライアント600は、クエリの実行結果をDBサーバ100から受信し、受信した実行結果をディスプレイにより表示する。
A
ここで、第2の実施の形態の情報処理システムでは、DBサーバ100のDBアクセス処理をクラスタ20でも実行可能である。すなわち、DBサーバ100は、自身の処理を、クラスタ20にオフロードさせることができる。オフロードにより、DBサーバ100の負荷を低減可能である。DBサーバ100は、DBを管理するDBMSを有するサーバであり、ネイティブと呼ばれることがある。ネイティブのDBMS機能を提供するソフトウェアの一例として、PostgreSQLが挙げられる(ただし、他のソフトウェアでもよい)。ネイティブ側のDBサーバは複数のサーバコンピュータにより構成されてもよい(例えば、ネイティブ側でも複数のDBサーバによる負荷分散や可用性向上を図ることもある)。また、クラスタ20は、オフロード先のサブシステムであり、アクセラレータと呼ばれることがある。アクセラレータ機能を提供するソフトウェアの一例として、Sparkが挙げられる(ただし、他のソフトウェアでもよい)。
Here, in the information processing system according to the second embodiment, the DB access processing of the
DBサーバ100は、クエリに対応する処理(クエリ処理と称する)を、クラスタ20に割り振る(オフロードする)ことで、当該処理の高速化を図れる。しかし、全てのクエリ処理をオフロードすればよいわけではない。例えば、クエリ処理の対象のテーブルのサイズやテーブルに対する処理の種別(例えば、インデックス(索引)スキャンか否かなど)によっては、クラスタ20よりもDBサーバ100の方が高速に処理を実行できることもある。
The
具体的には、クラスタ20では、クエリ処理が比較的大きなサイズのテーブルに対する処理である場合や、インデックススキャンを使用しない場合(シーケンシャルスキャンの場合)に、DBサーバ100よりも処理を高速に実行できる可能性がある。大量データに対する順次処理を、クラスタ20の複数のスレーブサーバにより分担して効率的に実行できるからである。他方、DBサーバ100では、クエリ処理が比較的小さなサイズのテーブルに対する処理である場合や、インデックススキャンを使用する場合に、クラスタ20よりも処理を高速に実行できる可能性がある。処理対象のデータサイズが比較的小さい場合、クラスタ20における分散化のための処理のオーバヘッドが本来の処理に比べて大きくなり得るからである。ただし、クラスタ20により用いられるアルゴリズムはブラックボックスであることが多い。このため、具体的なクエリに対して、DBサーバ100(ネイティブ)およびクラスタ20(アクセラレータ)の何れの方が処理を高速に実行できるかを、事前に評価することは難しい。
Specifically, in the
DBサーバ100は、DBサーバ100およびクラスタ20におけるこのような性質を考慮して、クエリに対する応答性能を高める機能を提供する。
図3は、DBサーバのハードウェア例を示す図である。DBサーバ100は、プロセッサ101、RAM102、HDD103、HBA(Host Bus Adapter)104、画像信号処理部105、入力信号処理部106、媒体リーダ107および通信インタフェース108を有する。各ハードウェアはDBサーバ100のバスに接続されている。
The
FIG. 3 is a diagram illustrating a hardware example of the DB server. The
プロセッサ101は、DBサーバ100の情報処理を制御するハードウェアである。プロセッサ101は、マルチプロセッサであってもよい。プロセッサ101は、例えばCPU、DSP、ASICまたはFPGAなどである。プロセッサ101は、CPU、DSP、ASIC、FPGAなどのうちの2以上の要素の組み合わせであってもよい。
The
RAM102は、DBサーバ100の主記憶装置である。RAM102は、プロセッサ101に実行させるOS(Operating System)のプログラムやアプリケーションプログラムの少なくとも一部を一時的に記憶する。また、RAM102は、プロセッサ101による処理に用いる各種データを記憶する。
The
HDD103は、DBサーバ100の補助記憶装置である。HDD103は、内蔵した磁気ディスクに対して、磁気的にデータの書き込みおよび読み出しを行う。HDD103は、OSのプログラム、アプリケーションプログラム、および各種データを記憶する。DBサーバ100は、フラッシュメモリやSSDなどの他の種類の補助記憶装置を備えてもよく、複数の補助記憶装置を備えてもよい。
The
HBA104は、ストレージ30との接続に用いられる接続インタフェースである。HBA104は、例えば、ファイバチャネル(FC:Fibre Channel)やSAS(Serial Attached SCSI、SCSIはSmall Computer System Interfaceの略)のインタフェースである。
The
画像信号処理部105は、プロセッサ101からの命令に従って、DBサーバ100に接続されたディスプレイ11に画像を出力する。ディスプレイ11として、CRT(Cathode Ray Tube)ディスプレイや液晶ディスプレイなどを用いることができる。
The image
入力信号処理部106は、DBサーバ100に接続された入力デバイス12から入力信号を取得し、プロセッサ101に出力する。入力デバイス12として、例えば、マウスやタッチパネルなどのポインティングデバイス、キーボードなどを用いることができる。
The input
媒体リーダ107は、記録媒体13に記録されたプログラムやデータを読み取る装置である。記録媒体13として、例えば、フレキシブルディスク(FD:Flexible Disk)やHDDなどの磁気ディスク、CD(Compact Disc)やDVD(Digital Versatile Disc)などの光ディスク、光磁気ディスク(MO:Magneto-Optical disk)を使用できる。また、記録媒体13として、例えば、フラッシュメモリカードなどの不揮発性の半導体メモリを使用することもできる。媒体リーダ107は、例えば、プロセッサ101からの命令に従って、記録媒体13から読み取ったプログラムやデータをRAM102またはHDD103に格納する。
The
通信インタフェース108は、ネットワーク10を介して他の装置と通信を行う。通信インタフェース108は、有線通信インタフェースでもよいし、無線通信インタフェースでもよい。
The
なお、マスタサーバ200、スレーブサーバ300,400,500およびクライアント600もDBサーバ100と同様のハードウェアを用いて実現できる。
図4は、システムの機能例を示す図である。DBサーバ100は、記憶部110、通信処理部120、進捗監視部130、クエリ実行部140および連携制御部150を有する。
The
FIG. 4 is a diagram illustrating an example of functions of the system. The
記憶部110は、クエリ処理の進捗に関する情報を記憶する。また、記憶部110は、オフロードを行うか否かの決定に用いられる情報(オフロード選択テーブル)を記憶する。
The
通信処理部120は、クライアント600からクエリを受信する。また、通信処理部120は、クエリ処理の実行結果を、クライアント600に送信する。
進捗監視部130は、クエリの内容に応じて、クエリに含まれる複数の処理のうち、進捗の監視対象とする監視対象処理を決定する。進捗監視部130は、DBサーバ100による監視対象処理の進捗、および、クラスタ20による監視対象処理の進捗を監視する。進捗監視部130は、DBサーバ100による監視対象処理の進捗およびクラスタ20による監視対象処理の進捗の監視に応じて、何れか一方によるクエリ処理を停止するように制御する。具体的には、進捗監視部130は、DBサーバ100およびクラスタ20のうち監視対象処理を早く実行した一方の実行結果を取得し、他方によるクエリ処理を停止するように制御する。
The
The
進捗監視部130は、クエリ処理の対象のテーブルのデータを、ストレージ30に記憶されたDB31から取得し、クエリ実行部140および連携制御部150に提供する。また、進捗監視部130は、クエリ実行部140および連携制御部150によるクエリ処理の実行結果を取得し、通信処理部120に提供する。
The
クエリ実行部140は、クエリ処理を実行する。クエリ実行部140は、DBMSにおけるSQLの実行エンジンである。
連携制御部150は、クラスタ20との連携を制御する。連携制御部150は、クエリ処理の実行をマスタサーバ200に依頼する。連携制御部150は、クエリ処理対象のテーブルのデータを、マスタサーバ200に提供する。また、連携制御部150は、クエリ処理の実行結果をマスタサーバ200から取得する。
The
The
マスタサーバ200は、分散制御部210を有する。分散制御部210は、スレーブサーバ300,400,500を用いたクエリの分散実行を制御する。分散制御部210は、連携制御部150からクエリ処理の依頼、および、クエリ処理対象のテーブルのデータを受信し、スレーブサーバ300,400,500それぞれにクエリ処理の各部分を割り振る。例えば、分散制御部210は、スレーブサーバ300,400,500それぞれにクエリ処理の異なる部分を割り振ることで、クエリ処理を高速化し得る。分散制御部210は、スレーブサーバ300,400,500からクエリ処理の実行結果を取得し、マージする。分散制御部210は、マージ後の実行結果を連携制御部150に応答する。
The
スレーブサーバ300は、分散実行部310を有する。スレーブサーバ400は、分散実行部410を有する。スレーブサーバ500は、分散実行部510を有する。分散実行部310,410,510は、分散制御部210により割り振られたクエリ処理の一部分を実行し、実行結果を分散制御部210に応答する。なお、マスタサーバ200も分散実行部の機能を有してもよい。
The
ここで、記憶部110は、RAM102またはHDD103に確保された記憶領域として実現される。通信処理部120、進捗監視部130、クエリ実行部140および連携制御部150の機能は、プロセッサ101がRAM102に記憶されたプログラムを実行することで発揮される。ただし、通信処理部120、進捗監視部130、クエリ実行部140および連携制御部150は、FPGAやASICなどのハードワイヤードロジックにより実現されてもよい。
Here, the
更に、分散制御部210の機能は、マスタサーバ200が備えるプロセッサが、マスタサーバ200が備えるRAMに記憶されたプログラムを実行することで発揮される。分散実行部310の機能は、スレーブサーバ300が備えるプロセッサが、スレーブサーバ300が備えるRAMに記憶されたプログラムを実行することで発揮される。分散実行部410の機能は、スレーブサーバ400が備えるプロセッサが、スレーブサーバ400が備えるRAMに記憶されたプログラムを実行することで発揮される。分散実行部510の機能は、スレーブサーバ500が備えるプロセッサが、スレーブサーバ500が備えるRAMに記憶されたプログラムを実行することで発揮される。
Furthermore, the function of the distributed
図5は、DBのテーブル例を示す図である。DB31は、テーブル31a,31b,31c,31d,・・・を含む。図5では、DB31に含まれる複数のテーブルのうち、テーブル31a,31bの内容が例示されている。
FIG. 5 is a diagram illustrating an example of a DB table. The
テーブル31aのテーブル名は、“tbl1”である。テーブル31aは、nameおよびageの項目(あるいは属性)を含む。nameの項目には、人物の名前が登録される。ageの項目には、人物の年齢が登録される。例えば、テーブル31aには、nameが“Alice”、ageが“31”という行(あるいは、タプル)が登録されている。これは、“Alice”という人物の年齢が“31”歳であることを示す。なお、1つの行を1つのレコードと称してもよい。 The table name of the table 31a is “tbl1”. The table 31a includes items (or attributes) of name and age. The name of the person is registered in the name item. The age of a person is registered in the item “age”. For example, a row (or tuple) in which name is “Alice” and age is “31” is registered in the table 31a. This indicates that the age of the person “Alice” is “31” years old. One row may be referred to as one record.
テーブル31bのテーブル名は、“tbl2”である。テーブル31bは、nameおよびstateの項目を含む。nameの項目には、人物の名前が登録される。stateの項目には、人物が属する地方の略称が登録される。例えば、テーブル31bには、nameが“Alice”、stateが“NY”という行が登録されている。これは、“Alice”という人物が属する地方の略称が“NY”(New Yorkの略)であることを示す。 The table name of the table 31b is “tbl2”. The table 31b includes items of name and state. The name of the person is registered in the name item. In the “state” item, a local abbreviation to which the person belongs is registered. For example, in the table 31b, a line where name is “Alice” and state is “NY” is registered. This indicates that the local abbreviation to which the person “Alice” belongs is “NY” (New York).
なお、テーブル31cのテーブル名は、“tbl3”であるとする。また、テーブル31dのテーブル名は、“tbl4”であるとする。
図6は、クエリの例を示す図である。クエリ40は、SQLを用いて記述されている。クエリ40は、複数の処理に対応する複数のコマンドを含む。クエリ40は、テーブル31a,31bをnameで結合し、結合後のテーブルからageが“40”以上である行(name,age,stateの組)を取り出す(選択する)操作である。クエリ40の例では、進捗監視部130は、SQLの構文により、クエリ40のプランツリーを生成する。プランツリーは、クエリの実行プランを表す情報である。
It is assumed that the table name of the table 31c is “tbl3”. Further, the table name of the table 31d is assumed to be “tbl4”.
FIG. 6 is a diagram illustrating an example of a query. The
図7は、プランツリーの例を示す図である。プランツリー50は、クエリ40に対応するプランツリーである。プランツリー50は、ノード51,52,53,54を含む。ノード51,52それぞれは、ノード53とエッジで接続される。ノード53は、ノード54とエッジで接続される。
FIG. 7 is a diagram illustrating an example of a plan tree. The
ノード51は、テーブル31aに対するage“40”以上である行のスキャンを表す。ここで、「スキャン」は、該当の条件に合致する行(条件がない場合は全部の行)をテーブルから抽出する処理である。ノード52は、テーブル31bに対するフルスキャン(全行のスキャン)を表す。ノード53は、ノード51,52のスキャン結果に対するnameによる結合演算(JOIN)を表す。ノード54は、結合結果に対するname,age,stateの選択演算(SELECT)を表す。ノード51,52はリーフ、または、葉ノードと呼ばれる。
The
プランツリー50によれば、DBサーバ100またはクラスタ20によりクエリ40を実行する場合、まず、テーブル31a,31bのスキャン(ノード51,52に相当)が実行される。次に、結合演算(ノード53に相当)が実行される。その後、選択演算(ノード54に相当)が実行される。なお、テーブル31a,31bに対して何れの種別(インデックススキャンまたはシーケンシャルスキャン)のスキャンを行うかは、クエリの内容に応じて、クエリ実行部140および分散制御部210により決定される。同じクエリであれば、クエリ実行部140および分散制御部210は同じ種別のスキャンを採用する。
According to the
ここで、DBに対するクエリ処理において、テーブルスキャンは、結合演算や選択演算に比べて演算コストが大きい傾向にある。例えば、テーブルによっては数万から数千万の行を含み、大量のデータに対するスキャンが行われ得るからである。そこで、進捗監視部130は、比較的負荷の大きなテーブルスキャンを、プランツリー50から特定し、監視対象とする。このとき、進捗監視部130は、プランツリー50に含まれる複数のテーブルスキャンのうち、監視対象とするテーブルスキャンを、スキャン対象のテーブルの情報量に基づいて更に絞り込む。
Here, in the query processing for the DB, the table scan tends to have a higher operation cost than the join operation or the selection operation. For example, some tables include tens of thousands to tens of millions of rows, and a large amount of data can be scanned. Accordingly, the
具体的には、進捗監視部130は、クエリによる処理対象である複数のテーブルのうち、サイズが最大のテーブルを基準テーブルとする。進捗監視部130は、当該複数のテーブルのうち、次の条件(1)または条件(2)を満たすテーブルを、監視対象テーブルと決定する。ここで、「サイズが最大」とは、「行数が最大」であることを示す。
Specifically, the
条件(1)は、「最大行数のテーブル(基準テーブル)であること」である。
条件(2)は、「閾値Y=(最大行数のテーブルの行数X)*(コスト値C)以上の行数をもつテーブルであること」である。ここで、コスト値Cとして、例えば、シーケンシャルスキャンによる演算コストに対するインデックススキャンの演算コストの比を用いることが考えられる。例えば、シーケンシャルスキャンの演算コストを“1.0”としたときのインデックススキャンの演算コストが“0.005”であれば、コスト値Cは、“0.005”である。
The condition (1) is “to be a table of maximum number of rows (reference table)”.
The condition (2) is “threshold Y = (number of rows in the table with the maximum number of rows X) * the table having the number of rows equal to or more than the cost value C”). Here, as the cost value C, for example, the ratio of the calculation cost of the index scan to the calculation cost of the sequential scan can be considered. For example, if the calculation cost of the index scan is “0.005” when the calculation cost of the sequential scan is “1.0”, the cost value C is “0.005”.
1つの例として、テーブル31aが1000万行であり、テーブル31bが5万行である場合を考える。この場合、プランツリー50によれば、テーブル31a,31bによるスキャンを含む。このうち、最大行数のテーブルは、テーブル31aである。また、最大行数Xは1000万である。したがって、閾値Y=XC=1000万*0.005=5万である。この場合、テーブル31bの行数は、5万行であるので、閾値Y以上であり、条件(2)を満たす。よって、進捗監視部130は、テーブル31a,31bを監視対象テーブルと決定する。
As an example, consider a case where the table 31a has 10 million rows and the table 31b has 50,000 rows. In this case, according to the
監視対象テーブルに対するテーブルスキャンは、監視対象処理に相当する。すなわち、進捗監視部130は、監視対象テーブルを決定することで、監視対象処理を決定しているともいえる。
A table scan for the monitoring target table corresponds to monitoring target processing. That is, it can be said that the
図8は、オフロード選択テーブルの例を示す図である。オフロード選択テーブル111は、記憶部110に格納される。オフロード選択テーブル111は、使用テーブル、スキャン種別、スキャン進捗率の差およびオフロード選択フラグの項目を含む。
FIG. 8 is a diagram illustrating an example of an offload selection table. The offload selection table 111 is stored in the
使用テーブルの項目には、過去に実行済のクエリにおける監視対象テーブルのテーブル名が登録される。スキャン種別の項目には、当該監視対象テーブルに対するテーブルスキャンで使用されたスキャン種別が登録される。スキャン種別“seq”は、シーケンシャルスキャンを表す。スキャン種別“ind”は、インデックススキャンを表す。スキャン進捗率の差の項目には、当該監視対象テーブルに対するDBサーバ100のスキャン進捗率と、クラスタ20のスキャン進捗率との最終的な差が登録される。スキャン進捗率は、スキャン対象のテーブルの全行数のうち、スキャン済の行数の割合(百分率とする)である。スキャン進捗率の差は、“(アクセラレータの進捗率)−(ネイティブの進捗率)”である。したがって、スキャン進捗率の差が正(全て正)の値であれば、アクセラレータ側の方が早く監視対象処理を完了したことになる。一方、スキャン進捗率の差が負(全て負)の値であれば、ネイティブ側の方が早く監視対象処理を完了したことになる。オフロード選択フラグの項目には、次回以降にオフロードを行うか否かを示すフラグが登録される。オフロード選択フラグ“TRUE”は、オフロードを行うことを示す。「オフロードを行う」とは、クラスタ20に該当のクエリ処理を割り振り、DBサーバ100では、当該クエリ処理を実行しないことを示す。オフロード選択フラグ“FALSE”は、オフロードを行わないことを示す。「オフロードを行わない」とは、クラスタ20に該当のクエリ処理を割り振らず、DBサーバ100で当該クエリ処理を実行することを示す。オフロード選択フラグは、該当行の実績において、DBサーバ100およびクラスタ20のうち、クエリの実行停止を指示した方を識別可能な識別情報であるといえる。
In the use table field, the table name of the monitoring target table in the query executed in the past is registered. The scan type used in the table scan for the monitoring target table is registered in the scan type item. The scan type “seq” represents a sequential scan. The scan type “ind” represents an index scan. In the item of the difference in scan progress rate, the final difference between the scan progress rate of the
ここで、使用テーブル、スキャン種別およびスキャン進捗率の差の項目には、複数の値(値の個数は、各項目で同じ)が登録され得る。使用テーブル、スキャン種別およびスキャン進捗率の差の項目に複数の値が登録される場合、複数の値は、順番通りに対応付けられる。 Here, a plurality of values (the number of values is the same for each item) can be registered in the items of the difference between the usage table, the scan type, and the scan progress rate. When a plurality of values are registered in the items of the difference between the usage table, the scan type, and the scan progress rate, the plurality of values are associated in order.
例えば、オフロード選択テーブル111には、使用テーブルが“tbl1,tbl2,tbl3”、スキャン種別が“seq,ind,seq”、スキャン進捗率の差が“30,20,50”、オフロード選択フラグが“TRUE”という情報が登録されている。 For example, in the offload selection table 111, the usage table is “tbl1, tbl2, tbl3”, the scan type is “seq, ind, seq”, the difference in scan progress rate is “30, 20, 50”, the offload selection flag Is registered as “TRUE”.
これは、テーブル名“tbl1”(テーブル31a)、“tbl2”(テーブル31b)、“tbl3”(テーブル31c)の3つの監視対象テーブルに対するテーブルスキャンを含むクエリが過去に実行された実績があることを示す。当該実績では、テーブル31aに対してシーケンシャルスキャンを実行し、スキャン進捗率の差が“30”であったことを示す。また、当該実績では、テーブル31bに対してインデックススキャンを実行し、スキャン進捗率の差が“20”であったことを示す。更に、当該実績では、テーブル31cに対してシーケンシャルスキャンを実行し、スキャン進捗率の差が“50”であったことを示す。そして、次回以降に、テーブル31aに対するシーケンシャルスキャン、テーブル31bに対するインデックススキャン、テーブル31cに対するシーケンシャルスキャンを行うクエリを受け付けた場合に、オフロードを行うことを示す。 This is because a query including a table scan for the three monitoring target tables having the table names “tbl1” (table 31a), “tbl2” (table 31b), and “tbl3” (table 31c) has been executed in the past. Indicates. This result shows that the sequential scan is executed on the table 31a and the difference in scan progress rate is “30”. In addition, the result shows that an index scan is performed on the table 31b, and the difference in scan progress rate is “20”. Further, the result shows that the sequential scan is executed on the table 31c, and the difference in the scan progress rate is “50”. Then, after the next time, when a query for performing a sequential scan with respect to the table 31a, an index scan with respect to the table 31b, and a sequential scan with respect to the table 31c is received, it indicates that offloading is performed.
また、例えば、オフロード選択テーブル111には、使用テーブルが“tbl2,tbl3”、スキャン種別が“ind,ind”、スキャン進捗率の差が“−30,−50”、オフロード選択フラグが“FALSE”という情報が登録されている。 Further, for example, in the offload selection table 111, the usage table is “tbl2, tbl3”, the scan type is “ind, ind”, the difference in scan progress rate is “−30, −50”, and the offload selection flag is “ The information “FALSE” is registered.
これは、テーブル名“tbl2”(テーブル31b)、“tbl3”(テーブル31c)の2つのテーブルに対する監視対象テーブルに対するテーブルスキャンを含むクエリが過去に実行された実績があることを示す。当該実績では、テーブル31bに対してインデックススキャンを実行し、スキャン進捗率の差が“−30”であったことを示す。また、当該実績では、テーブル31cに対してインデックススキャンを実行し、スキャン進捗率の差が“−50”であったことを示す。そして、次回以降に、テーブル31bに対するインデックススキャン、テーブル31cに対するインデックススキャンを行うクエリを受け付けた場合に、オフロードを行わないことを示す。 This indicates that there has been a past execution result of a query including a table scan for the monitoring target table with respect to the two tables having the table names “tbl2” (table 31b) and “tbl3” (table 31c). The result shows that the index scan is executed on the table 31b and the difference in scan progress rate is “−30”. In addition, the result shows that the index scan is performed on the table 31c, and the difference in the scan progress rate is “−50”. Then, when a query for performing an index scan for the table 31b and an index scan for the table 31c is received after the next time, it indicates that offloading is not performed.
図9は、スキャン進捗率の差の例を示す図である。進捗監視部130は、過去に実行された実績のあるクエリに対して、DBサーバ100(ネイティブ)およびクラスタ20(アクセラレータ)による最終的な進捗率の差を求める。進捗率の差は、前述のように、“(アクセラレータの進捗率)−(ネイティブの進捗率)”である。したがって、監視対象処理の最終的な進捗率の差が正(監視対象処理が複数の場合、全て正)であれば、アクセラレータによる処理の方が、ネイティブによる処理よりも速いことになる。一方、監視対象処理の最終的な進捗率の差が負(監視対象処理が複数の場合、全て負)であれば、ネイティブによる処理の方が、アクセラレータによる処理よりも速いことになる。
FIG. 9 is a diagram illustrating an example of a difference in scan progress rate. The
以下では主に、スキャン進捗率の差を、“(アクセラレータの進捗率)−(ネイティブの進捗率)”する例を示すが、“(ネイティブの進捗率)−(アクセラレータの進捗率)”としてもよい。この場合、スキャン進捗率の差の正の値および負の値の解釈が逆転することになる。 In the following, an example in which the difference in scan progress rate is “(accelerator progress rate) − (native progress rate)” is shown, but “(native progress rate) − (accelerator progress rate)” is also shown. Good. In this case, the interpretation of the positive value and the negative value of the difference in scan progress rate is reversed.
次に、DBサーバ100による処理手順を説明する。
図10は、DBサーバの処理の例を示すフローチャートである。以下、図10に示す処理をステップ番号に沿って説明する。
Next, a processing procedure by the
FIG. 10 is a flowchart illustrating an example of processing of the DB server. In the following, the process illustrated in FIG. 10 will be described in order of step number.
(S1)通信処理部120は、クライアント600からクエリを受信する。
(S2)進捗監視部130は、通信処理部120により受信されたクエリを取得し、クエリ実行制御を行う。処理の詳細は後述される。進捗監視部130は、クエリ実行制御により、DBサーバ100またはクラスタ20によるクエリの実行結果を取得し、通信処理部120に提供する。
(S1) The
(S2) The
(S3)通信処理部120は、クライアント600にクエリの実行結果を送信する。
図11は、クエリ実行制御の例を示すフローチャートである。以下、図11に示す処理をステップ番号に沿って説明する。以下の手順は、図10のステップS2に相当する。
(S3) The
FIG. 11 is a flowchart illustrating an example of query execution control. In the following, the process illustrated in FIG. 11 will be described in order of step number. The following procedure corresponds to step S2 in FIG.
(S11)進捗監視部130は、クエリのSQL構文に基づいて、プランツリーを作成し、プランツリーを基にテーブルスキャンで使用されるテーブル(使用テーブル)を特定する。進捗監視部130は、ストレージ30に記憶されたDB31から使用テーブルを取得する。進捗監視部130は、取得した使用テーブルを記憶部110に格納する。
(S11) The
(S12)進捗監視部130は、所定行数以上の使用テーブルを監視対象テーブルと決定する。具体的には、進捗監視部130は、前述のように次の条件(1)または条件(2)を満たすテーブルを監視対象テーブルと決定する。条件(1)は、「最大行数のテーブル(基準テーブル)であること」である。条件(2)は、「閾値Y=(最大行数のテーブルの行数X)*(コスト値C)以上の行数をもつテーブルであること」である。
(S12) The
(S13)進捗監視部130は、監視対象テーブルのスキャン種別を特定する。監視対象テーブルが複数の場合、進捗監視部130は、監視対象テーブル毎にスキャン種別を特定する。スキャン種別は、クエリの内容に応じてクエリ実行部140(またはDBMSの所定の機能)により決定される。進捗監視部130は、監視対象テーブルに対して選択されるスキャン種別を、クエリ実行部140(またはDBMSの所定の機能)に問い合わせることで、当該スキャン種別を取得してもよい。
(S13) The
(S14)進捗監視部130は、記憶部110に記憶されたオフロード選択テーブル111を参照して、オフロード選択テーブル111に今回クエリの処理内容と完全一致するタプル(完全一致タプルと称する)があるか否かを判定する。ここで、処理内容とは、監視対象テーブルおよびスキャン種別である。監視対象テーブルが今回クエリと全て同じで、各監視対象テーブルに対するスキャン種別も今回クエリと全て同じである場合に、オフロード選択テーブル111に完全一致タプルがあることになる。オフロード選択テーブル111に完全一致タプルがある場合、進捗監視部130は、ステップS15に処理を進める。オフロード選択テーブル111に完全一致タプルがない場合、進捗監視部130は、ステップS16に処理を進める。
(S14) The
(S15)進捗監視部130は、オフロード選択テーブル111の完全一致タプルにおけるオフロード選択フラグに応じた依頼先に、クエリ処理の実行開始を指示する。具体的には、該当のオフロード選択フラグが“FALSE”の場合、進捗監視部130は、クエリ実行部140に、クエリ処理の実行開始を指示する。また、該当のオフロード選択フラグが“TRUE”の場合、進捗監視部130は、クエリ処理の実行開始の指示をマスタサーバ200に送るよう連携制御部150に指示する。そして、進捗監視部130は、ステップS21に処理を進める。
(S15) The
(S16)進捗監視部130は、オフロード選択テーブル111を参照して、オフロード選択テーブル111に今回クエリの処理内容と部分一致するタプル(部分一致タプルと称する)があるか否かを判定する。オフロード選択テーブル111の行のうち、使用テーブルが今回クエリの監視対象テーブルと一部分であり、当該使用テーブルに対するスキャン種別も今回クエリの当該一部分に対応する監視対象テーブルに対するスキャン種別と同じである行が、部分一致タプルである。オフロード選択テーブル111に部分一致タプルがある場合、進捗監視部130は、ステップS17に処理を進める。オフロード選択テーブル111に部分一致タプルがない場合、進捗監視部130は、ステップS18に処理を進める。なお、部分一致タプルに対応する過去実績の監視対象処理は、今回クエリにおける複数の監視対象処理のうちの第1の部分であるといえる。一方、今回クエリにおける複数の監視対象処理のうちの第1の部分以外の第2の部分は、新規部分であるといえる。
(S16) The
(S17)進捗監視部130は、クエリ実行制御におけるサブ制御を実行する。サブ制御の詳細は後述される。そして、進捗監視部130は、ステップS20に処理を進める。
(S18)進捗監視部130は、ネイティブ(DBサーバ100)とアクセラレータ(クラスタ20)との両方にクエリ処理の実行開始を指示し、両方の進捗情報の取得を開始する。具体的には、進捗監視部130は、クエリ処理の実行開始をクエリ実行部140に指示する。また、進捗監視部130は、クエリ処理の実行開始の指示をマスタサーバ200に送るよう連携制御部150に指示する。また、進捗監視部130は、クエリ実行部140および連携制御部150に、クエリ処理の使用テーブルを提供する。クエリ実行部140は、提供された使用テーブルに基づいてクエリ処理を実行する。連携制御部150は、クエリ処理の実行開始の指示、および、提供された使用テーブルを、マスタサーバ200に送信する。
(S17) The
(S18) The
(S19)進捗監視部130は、ステップS13で特定した全ての監視対象テーブルに対する一方のスキャンが完了すると、クエリ処理の実行停止を他方に指示する。例えば、クエリ実行部140の方が、クラスタ20よりも先に、全ての監視対象テーブルに対するスキャンを完了したとする。この場合、進捗監視部130は、クエリ処理の実行停止の指示をマスタサーバ200に送るよう連携制御部150に指示する。連携制御部150は、当該指示に応じて、マスタサーバ200にクエリ処理の実行停止の指示を送信する。また、例えば、クラスタ20の方が、クエリ実行部140よりも先に、全ての監視対象テーブルに対するスキャンを完了したとする。この場合、進捗監視部130は、クエリ処理の実行停止を、クエリ実行部140に指示する。クエリ実行部140は、当該指示に応じて該当のクエリ処理の実行を停止する。
(S19) The
(S20)進捗監視部130は、オフロード選択テーブル111に今回の実績を登録する。具体的には、進捗監視部130は、オフロード選択テーブル111に、今回のクエリの使用テーブル、スキャン種別を登録する。また、進捗監視部130は、ステップS19における両方の最終的なスキャン進捗率(一方での監視対象テーブルに対するスキャン進捗率が全て100%)を基に、スキャン進捗率の差を計算し、オフロード選択テーブル111に登録する。スキャン進捗率の差は、“(アクセラレータの進捗率)−(ネイティブの進捗率)”である。したがって、進捗監視部130は、スキャン進捗率の差が全て正の値の場合、オフロード選択テーブル111にオフロード選択フラグ“TRUE”を登録する。また、進捗監視部130は、スキャン進捗率の差が全て負の値の場合、オフロード選択テーブル111にオフロード選択フラグ“FALSE”を登録する。
(S20) The
(S21)進捗監視部130は、クエリ実行部140または連携制御部150のうち、クエリ処理を実行完了した方からクエリ処理の実行結果を取得し、取得した実行結果を通信処理部120に提供する。そして、進捗監視部130は、クエリ実行制御の処理を終了する。ここで、連携制御部150から取得されるクエリ処理の実行結果は、連携制御部150がマスタサーバ200から取得したクラスタ20によるクエリ処理の実行結果である。
(S21) The
ここで、ステップS18では、例えば、進捗監視部130は、監視対象テーブルに対するテーブルスキャンの進捗をクエリ実行部140に問い合わせることで、クエリ実行部140によるスキャン進捗率を取得してもよい。また、進捗監視部130は、監視対象テーブルに対するテーブルスキャンの進捗を、連携制御部150を介して、クラスタ20に問い合わせることで、クラスタ20によるスキャン進捗率を取得してもよい。
Here, in step S <b> 18, for example, the
あるいは、進捗監視部130は、クエリ実行部140によるテーブルスキャンの進捗に応じて、監視対象テーブルに含まれるレコードを、順番に、クエリ実行部140に提供することも考えられる。この場合、進捗監視部130は、クエリ実行部140に対するレコードの提供状況から、クエリ実行部140によるスキャン進捗率を取得してもよい。また、進捗監視部130は、クラスタ20によるテーブルスキャンの進捗に応じて、監視対象テーブルに含まれるレコードを、順番に、連携制御部150を介してクラスタ20に提供することも考えられる。この場合、進捗監視部130は、クラスタ20に対するレコードの提供状況から、クラスタ20によるスキャン進捗率を取得してもよい。
Alternatively, the
図12は、サブ制御の例を示すフローチャートである。以下、図12に示す処理をステップ番号に沿って説明する。以下の手順は、図11のステップS17に相当する。
(S31)進捗監視部130は、ネイティブ(DBサーバ100)とアクセラレータ(クラスタ20)との両方にクエリ処理の実行開始を指示する。具体的には、進捗監視部130は、クエリ処理の実行開始をクエリ実行部140に指示する。また、進捗監視部130は、クエリ処理の実行開始の指示をマスタサーバ200に送るよう連携制御部150に指示する。また、進捗監視部130は、クエリ実行部140および連携制御部150に、クエリ処理の使用テーブルを提供する。クエリ実行部140は、提供された使用テーブルに基づいてクエリ処理を実行する。連携制御部150は、クエリ処理の実行開始の指示、および、提供された使用テーブルを、マスタサーバ200に送信する。
FIG. 12 is a flowchart illustrating an example of sub-control. In the following, the process illustrated in FIG. 12 will be described in order of step number. The following procedure corresponds to step S17 in FIG.
(S31) The
(S32)進捗監視部130は、複数の監視対象テーブルに対するテーブルスキャンを、過去の実績に対する部分一致部分と、新規部分との2つに分けて監視し、各監視対象テーブルに対するスキャン進捗率の取得を開始する。
(S32) The
(S33)進捗監視部130は、ネイティブおよびアクセラレータの両方で部分一致部分のスキャン進捗率が新規部分よりも先に100%に到達したか否かを判定する。ネイティブおよびアクセラレータの両方で部分一致部分のスキャン進捗率が新規部分よりも先に100%に到達した場合、進捗監視部130は、ステップS34に処理を進める。ネイティブおよびアクセラレータの両方で部分一致部分のスキャン進捗率が新規部分よりも先に100%に到達していない場合、進捗監視部130は、ステップS35に処理を進める。
(S33) The
なお、部分一致部分および新規部分の両方または何れかが複数の監視対象テーブルに対するテーブルスキャン(監視対象処理)を含むこともある。例えば、部分一致部分が複数の監視対象テーブルに対する複数のテーブルスキャンを含む場合、進捗監視部130は、当該複数のテーブルスキャンの全てのスキャン進捗率が100%になったとき、部分一致部分のスキャン進捗率が100%になったとみなす。新規部分についても同様である。
Note that either or both of the partially matching part and the new part may include table scans (monitoring target processing) for a plurality of monitoring target tables. For example, when the partially matching portion includes a plurality of table scans for a plurality of monitoring target tables, the
(S34)進捗監視部130は、ネイティブおよびアクセラレータのうち、新規部分のスキャン進捗率の低い方に、クエリ処理の実行停止を指示する。考慮すべきスキャン進捗率が複数の場合、進捗監視部130は、スキャン進捗率の平均値の低い方にクエリの処理の実行停止を指示してもよい。例えば、クラスタ20の方が新規部分のスキャン進捗率が低い場合、進捗監視部130は、クエリ処理の実行停止の指示をマスタサーバ200に送るよう連携制御部150に指示する。連携制御部150は、当該指示に応じて、マスタサーバ200にクエリ処理の実行停止の指示を送信する。また、例えば、クエリ実行部140の方が新規部分のスキャン進捗率が低い場合、進捗監視部130は、クエリ処理の実行停止をクエリ実行部140に指示する。クエリ実行部140は、当該指示に応じて、該当のクエリ処理の実行を停止する。そして、進捗監視部130は、処理を終了する。
(S34) The
(S35)進捗監視部130は、ネイティブおよびアクセラレータの少なくとも一方で新規部分のスキャン進捗率が部分一致部分よりも先に100%に到達したか否かを判定する。ネイティブおよびアクセラレータの少なくとも一方で新規部分のスキャン進捗率が部分一致部分よりも先に100%に到達した場合、進捗監視部130は、ステップS36に処理を進める。ネイティブおよびアクセラレータの少なくとも一方で新規部分のスキャン進捗率が部分一致部分よりも先に100%に到達していない場合、進捗監視部130は、ステップS33に処理を進める(スキャン進捗率の監視を継続する)。
(S35) The
なお、部分一致部分および新規部分の両方または何れかが複数の監視対象テーブルに対するテーブルスキャン(監視対象処理)を含むこともある。例えば、部分一致部分が複数の監視対象テーブルに対する複数のテーブルスキャンを含む場合、進捗監視部130は、当該複数のテーブルスキャンの全てのスキャン進捗率が100%になったとき、部分一致部分のスキャン進捗率が100%になったとみなす。新規部分についても同様である。
Note that either or both of the partially matching part and the new part may include table scans (monitoring target processing) for a plurality of monitoring target tables. For example, when the partially matching portion includes a plurality of table scans for a plurality of monitoring target tables, the
(S36)進捗監視部130は、現スキャン進捗率の差の絶対値が、記憶部110に記憶されたオフロード選択テーブル111の部分一致タプルにおけるスキャン進捗率の差の絶対値以上であるか否かを判定する。現スキャン進捗率の差の絶対値が、部分一致タプルにおけるスキャン進捗率の差の絶対値以上の場合、進捗監視部130は、ステップS37に処理を進める。現スキャン進捗率の差の絶対値が、部分一致タプルにおけるスキャン進捗率の差の絶対値以上でない場合、進捗監視部130は、ステップS33に処理を進める(スキャン進捗率の監視を継続する)。ここで、部分一致タプルが複数の場合、進捗監視部130は一致する監視対象テーブルの数が最大の部分一致タプルを選択する。
(S36) The
なお、考慮すべきスキャン進捗率の差が複数の場合もある。この場合、進捗監視部130は、全ての現スキャン進捗率の差の絶対値が、対応する部分一致タプルのスキャン進捗率の差の絶対値以上である場合に、ステップS36 Yesであり、そうでない場合に、ステップS36 Noとする。
There may be a plurality of scan progress rate differences to be considered. In this case, the
更に、進捗監視部130は、現スキャン進捗率の差の符号(正または負)と、部分一致タプルにおけるスキャン進捗率の差の符号(正または負)との一致を確認してもよい。進捗監視部130は、符号が一致する場合に、両方の差の絶対値を比較し、符号が一致しない場合に、ステップS33に処理を進めてもよい。
Further, the
(S37)進捗監視部130は、新規部分のスキャン進捗率が100%に到達した依頼先は、部分一致タプルのオフロード選択フラグにより特定される実行継続先(過去の実績でクエリ処理を停止させなかった方)と一致するか否かを判定する。一致する場合、進捗監視部130は、ステップS38に処理を進める。一致しない場合、進捗監視部130は、ステップS33に処理を進める(スキャン進捗率の監視を継続する)。
(S37) The
(S38)進捗監視部130は、部分一致部分のスキャン進捗率の低い方にクエリ処理の実行停止を指示する。考慮すべきスキャン進捗率が複数の場合、進捗監視部130は、スキャン進捗率の平均値の低い方にクエリの処理の実行停止を指示してもよい。ここでは、ステップS37で特定される実行継続先とは異なる方に実行停止の指示が行われることが期待される。例えば、クラスタ20によるクエリ処理の実行停止を指示する場合、進捗監視部130は、クエリ処理の実行停止の指示をマスタサーバ200に送るよう連携制御部150に指示する。連携制御部150は、当該指示に応じて、マスタサーバ200にクエリ処理の実行停止の指示を送信する。また、クエリ実行部140によるクエリ処理を停止させる場合、進捗監視部130は、該当のクエリ処理の実行停止をクエリ実行部140に指示する。クエリ実行部140は、当該指示に応じて、該当のクエリ処理の実行を停止する。そして、進捗監視部130は、サブ制御の処理を終了する。
(S38) The
ここで、ステップS36,S37の判定は、部分一致部分における現テーブルスキャンのスキャン進捗率に対して過去の実績を流用できることを確認する処理であるといえる。すなわち、ネイティブおよびアクセラレータの両方で新規部分に対応する監視対象処理が完了している場合、部分一致部分に対応する監視対象処理に対する過去の実績を基にネイティブおよびアクセラレータの何れか一方のクエリ実行を停止させることが考えられる。 Here, it can be said that the determinations in steps S36 and S37 are processes for confirming that past results can be used for the scan progress rate of the current table scan in the partially matched portion. In other words, if the monitoring target process corresponding to the new part is completed in both the native and accelerator, the query execution of either the native or accelerator is executed based on the past results for the monitoring target process corresponding to the partial matching part. It is possible to stop.
このとき、過去の実績においてクエリ実行を停止させなかった方(部分一致タプルのオフロード選択フラグにより特定可能)で今回の新規部分に対する監視対象処理が完了している場合、部分一致タプルで示される結果を今回のクエリ処理に流用できる可能性がある。今回クエリで未完了である部分一致部分に対応する監視対象処理については、過去の実績においてオフロード選択フラグにより特定されるクエリ実行を停止させなかった実行主体側(実行継続先)の方が、他方よりも早く実行完了できると推定されるからである。 At this time, when the monitoring target process for the new part is completed by the person who has not stopped the query execution in the past results (which can be specified by the offload selection flag of the partial match tuple), the partial match tuple is indicated. The result may be diverted to this query processing. For the monitoring target process corresponding to the partially matched part that is not completed in the current query, the execution subject side (execution destination) that did not stop the query execution specified by the offload selection flag in the past results, This is because it is estimated that the execution can be completed earlier than the other.
したがって、この場合、進捗監視部130は、部分一致部分に対するスキャン進捗率の差の絶対値よりも、当該部分一致部分に対する現スキャン進捗率の差の絶対値の方が大きい場合に、部分一致部分のスキャン進捗率の低い方にクエリ処理の実行停止を指示する。今回の進捗率の差の幅が過去の実績以上であれば、部分一致タプルの実績を適用してもよいと考えられるからである。
Therefore, in this case, the
このとき、ステップS38の「部分一致部分のスキャン進捗率の低い方」は、部分一致タプルのオフロード選択フラグで示される過去の実績でクエリ実行を停止させた方(本例において、オフロード選択フラグ“FALSE”ならネイティブ、同“TRUE”ならアクセラレータ)に一致することが期待される。また、ステップS36で例示したように、ステップS36でスキャン進捗率の差の符号の一致も確認していると、「部分一致部分のスキャン進捗率の低い方」は部分一致タプルのオフロード選択フラグで示される過去の実績でクエリ実行を停止させた方に一致する。 At this time, “the one with the lower scan progress rate of the partially matched portion” in step S38 is the one in which the query execution is stopped based on the past results indicated by the offload selection flag of the partially matched tuple (in this example, the offload selection is selected). The flag “FALSE” is expected to match the native, and the same “TRUE” to the accelerator). Further, as exemplified in step S36, when the coincidence of the signs of the scan progress rate differences is also confirmed in step S36, “the lower scan progress rate of the partially matched portion” is the offload selection flag of the partially matched tuple. It matches the person who stopped query execution in the past results shown by.
なお、ステップS36,37の実行順は逆でもよい。
次に、以上の手順によるDBサーバ100によるクエリ実行制御の具体例を説明する。
図13は、クエリ実行制御の第1の例を示す図である。図13の左側から右側へ向かう方向が時間軸の正方向である(以降の図でも同様である)。
The execution order of steps S36 and 37 may be reversed.
Next, a specific example of query execution control by the
FIG. 13 is a diagram illustrating a first example of query execution control. The direction from the left side to the right side in FIG. 13 is the positive direction of the time axis (the same applies to the following drawings).
時刻T11において、DBサーバ100は、クライアント600によるクエリの入力を受け付ける。該当のクエリの内容に対応する実績は、オフロード選択テーブル111に未だ記録されていないものとする。DBサーバ100は、クエリからプランツリーを作成し、監視対象テーブルを決定する。ここでは、監視対象テーブルは、テーブル31a,31bであるとする。DBサーバ100は、DBサーバ100のクエリ実行部140(ネイティブのDBMS)およびクラスタ20(アクセラレータ)の両方に、受け付けたクエリの実行開始を指示する。クエリ実行部140は、実行開始の指示を受け付けるとクエリの実行を開始する。クラスタ20は、実行開始の指示を受け付けるとクエリの実行を開始する。DBサーバ100は、クエリ実行部140およびクラスタ20それぞれによるテーブル31a,31bのテーブルスキャンの進捗の監視を開始する。
At time T <b> 11, the
時刻T12において、DBサーバ100は、クエリ実行部140について、テーブル31aのスキャン進捗率60%であり、テーブル31bのスキャン進捗率100%を検出する。また、DBサーバ100は、クラスタ20についてテーブル31aのスキャン進捗率100%、テーブル31bのスキャン進捗率100%を検出する。このため、DBサーバ100は、クエリ実行部140に、該当のクエリの実行停止を指示する。クエリ実行部140は、該当のクエリの実行を停止する。クラスタ20は、該当のクエリの実行を継続する。
At time T12, the
時刻T13において、クラスタ20は、クエリの実行を完了する。DBサーバ100は、クラスタ20からクエリの実行結果を取得し、クライアント600に送信する。
このように、DBサーバ100は、DBサーバ100におけるクエリ処理を、時刻T12で停止させることができる。その結果、時刻T12の段階で、DBサーバ100における当該クエリ処理のためのリソースを解放させることができる。
At time T13, the
Thus, the
図14は、クエリ実行制御の第2の例を示す図である。図14の例では、DBサーバ100に入力されるクエリの内容は、テーブル31a(テーブル名“tbl1”)に対するシーケンシャルスキャン、および、テーブル31c(テーブル名“tbl3”)に対するシーケンシャルスキャンを含むとする。監視対象テーブルは、テーブル31a,31cであるとする。
FIG. 14 is a diagram illustrating a second example of query execution control. In the example of FIG. 14, it is assumed that the contents of the query input to the
更に、テーブル31aに対するシーケンシャルスキャンおよびテーブル31cに対するシーケンシャルスキャンを行ったクエリの過去の実績(入力されるクエリに対する完全一致タプル)が、オフロード選択テーブル111に登録されているものとする。例えば、DBサーバ100は次の制御を行う。
Furthermore, it is assumed that past results (complete match tuples for input queries) of queries that have been subjected to sequential scan for the table 31a and sequential scan for the table 31c are registered in the offload selection table 111. For example, the
時刻T21において、DBサーバ100は、クライアント600によるクエリの入力を受け付ける。DBサーバ100は、当該クエリがテーブル31a,31cそれぞれに対するシーケンシャルスキャンを含むことを特定する。また、DBサーバ100は、当該クエリにおける監視対象テーブルをテーブル31a,31cと決定する。DBサーバ100は、オフロード選択テーブル111を参照して、テーブル31aに対するシーケンシャルスキャン、および、テーブル31cに対するシーケンシャルスキャンを行ったクエリの実績に対応する行を特定する。特定された行は、入力されたクエリの内容に対する完全一致タプルである。そして、DBサーバ100は、特定された行に設定されたオフロード選択フラグが“TRUE”であることを特定する。
At time T <b> 21, the
このため、DBサーバ100は、今回受け付けたクエリの実行開始をクラスタ20に指示する。また、DBサーバ100は、当該クエリの実行開始をDBサーバ100に指示しない。したがって、DBサーバ100では当該クエリを最初から実行しないことになる。
For this reason, the
時刻T22において、クラスタ20は、クエリの実行を完了する。DBサーバ100は、クラスタ20からクエリの実行結果を取得し、クライアント600に送信する。
このように、DBサーバ100は、過去の実績を基に、DBサーバ100またはクラスタ20の一方に対してクエリの実行開始の指示を行わないよう制御することもできる。これにより、DBサーバ100による余計な処理の実行を抑えられる。その結果、当該処理によりDBサーバ100で余計なリソースが使用されることを抑えられる。
At time T22, the
As described above, the
図15は、クエリ実行制御の第3の例を示す図である。図15の例では、DBサーバ100に入力されるクエリの内容は、テーブル31b(テーブル名“tbl2”)に対するインデックススキャン、テーブル31c(テーブル名“tbl3”)に対するインデックススキャン、および、テーブル31d(テーブル名“tbl4”)に対するシーケンシャルスキャンを含むとする。監視対象テーブルは、テーブル31b,31c,31dであるとする。
FIG. 15 is a diagram illustrating a third example of query execution control. In the example of FIG. 15, the contents of the query input to the
また、テーブル31b,31cそれぞれに対するインデックスキャン、および、テーブル31dに対するシーケンシャルスキャンを行ったクエリの過去の実績(入力されるクエリの内容に対する完全一致タプル)が、オフロード選択テーブル111に登録されていないものとする。更に、テーブル31bに対するインデックススキャンおよびテーブル31cに対するインデックススキャンを行ったクエリの過去の実績(入力されたクエリの内容に対する部分一致タプル)が、オフロード選択テーブル111に登録されているものとする。例えば、DBサーバ100は次の制御を行う。
In addition, past results of queries that have been index-scanned for each of the tables 31b and 31c and a sequential scan for the table 31d (a complete match tuple for the contents of the input query) are not registered in the offload selection table 111. Shall. Furthermore, it is assumed that the past results (partial match tuples for the contents of the input query) of the queries that have performed the index scan on the table 31b and the index scan on the table 31c are registered in the offload selection table 111. For example, the
時刻T31において、DBサーバ100は、クライアント600によるクエリの入力を受け付ける。DBサーバ100は、当該クエリがテーブル31b,31cそれぞれに対するインデックススキャン、および、テーブル31dに対するシーケンシャルスキャンを含むことを特定する。また、DBサーバ100は、当該クエリにおける監視対象テーブルをテーブル31b,31c,31dと決定する。DBサーバ100は、オフロード選択テーブル111を参照して、テーブル31b,31cそれぞれに対するシーケンシャルスキャンを行ったクエリの実績に対応する行を特定する。特定された行は、入力されたクエリの内容に対する部分一致タプルである。
At time T <b> 31, the
DBサーバ100は、DBサーバ100のクエリ実行部140およびクラスタ20の両方に、受け付けたクエリの実行開始を指示する。クエリ実行部140は、実行開始の指示を受け付けるとクエリの実行を開始する。クラスタ20は、実行開始の指示を受け付けるとクエリの実行を開始する。DBサーバ100は、クエリ実行部140およびクラスタ20それぞれによるテーブル31a,31bのテーブルスキャンの進捗の監視を開始する。この場合、DBサーバ100は、複数の監視対象テーブルのうち、部分一致部分(テーブル31b,31c)と、新規部分(テーブル31d)とに対するテーブルスキャンを分けて監視する。
The
時刻T32において、DBサーバ100は、クエリ実行部140について、テーブル31bのスキャン進捗率100%、テーブル31cのスキャン進捗率100%、および、テーブル31dのスキャン進捗率80%を検出する。また、DBサーバ100は、クラスタ20について、テーブル31bのスキャン進捗率100%、テーブル31cのスキャン進捗率100%、および、テーブル31dのスキャン進捗率90%を検出する。
At time T32, the
この場合、複数の監視対象テーブルのうち、部分一致部分(テーブル31b,31c)に対するスキャン進捗率がクエリ実行部140およびクラスタ20の両方で全て100%である。このため、DBサーバ100は、複数の監視対象テーブルのうちの新規部分(テーブル31d)のスキャン進捗率が低い方に、クエリの実行停止を指示する。この例では、クエリ実行部140によるテーブル31dのスキャン進捗率の方が、クラスタ20によるテーブル31dのスキャン進捗率よりも低い。したがって、DBサーバ100は、クエリ実行部140に、当該クエリの実行停止を指示する。クエリ実行部140は、実行停止の指示を受け付けると、当該クエリの実行を停止する。
In this case, the scan progress rates for the partially matched portions (tables 31b and 31c) among the plurality of monitoring target tables are all 100% in both the
時刻T33において、クラスタ20は、クエリの実行を完了する。DBサーバ100は、クラスタ20からクエリの実行結果を取得し、クライアント600に送信する。
このように、DBサーバ100は、DBサーバ100におけるクエリ処理を、時刻T32で停止させることができる。その結果、時刻T32の段階で、DBサーバ100における当該クエリ処理のためのリソースを解放させることができる。特に、過去の実績を用いることで、図13の場合に比べて、複数の監視対象テーブルの全てのスキャン進捗率が100%に到達する前に、ネイティブまたはアクセラレータのうちの一方のクエリの実行を停止させることができる。その結果、リソースの解放を一層早めることができる。
At time T33, the
Thus, the
図16は、クエリ実行制御の第4の例を示す図である。図16の例では、DBサーバ100に入力されるクエリの内容は、テーブル31b(テーブル名“tbl2”)に対するインデックススキャン、テーブル31c(テーブル名“tbl3”)に対するインデックススキャン、および、テーブル31d(テーブル名“tbl4”)に対するシーケンシャルスキャンを含むとする。監視対象テーブルは、テーブル31b,31c,31dであるとする。
FIG. 16 is a diagram illustrating a fourth example of query execution control. In the example of FIG. 16, the contents of the query input to the
また、テーブル31b,31cそれぞれに対するインデックスキャン、および、テーブル31dに対するシーケンシャルスキャンを行ったクエリの過去の実績(入力されるクエリの内容に対する完全一致タプル)が、オフロード選択テーブル111に登録されていないものとする。更に、テーブル31bに対するインデックススキャンおよびテーブル31cに対するインデックススキャンを行ったクエリの過去の実績(入力されたクエリの内容に対する部分一致タプル)が、オフロード選択テーブル111に登録されているものとする。例えば、DBサーバ100は次の制御を行う。
In addition, past results of queries that have been index-scanned for each of the tables 31b and 31c and a sequential scan for the table 31d (a complete match tuple for the contents of the input query) are not registered in the offload selection table 111. Shall. Furthermore, it is assumed that the past results (partial match tuples for the contents of the input query) of the queries that have performed the index scan on the table 31b and the index scan on the table 31c are registered in the offload selection table 111. For example, the
時刻T41において、DBサーバ100は、クライアント600によるクエリの入力を受け付ける。DBサーバ100は、当該クエリがテーブル31b,31cそれぞれに対するインデックススキャン、および、テーブル31dに対するシーケンシャルスキャンを含むことを特定する。また、DBサーバ100は、当該クエリにおける監視対象テーブルをテーブル31b,31c,31dと決定する。DBサーバ100は、オフロード選択テーブル111を参照して、テーブル31b,31cそれぞれに対するシーケンシャルスキャンを行ったクエリの実績に対応する行を特定する。特定された行は、入力されたクエリの内容に対する部分一致タプルである。
At time T <b> 41, the
DBサーバ100は、DBサーバ100のクエリ実行部140およびクラスタ20の両方に、受け付けたクエリの実行開始を指示する。クエリ実行部140は、実行開始の指示を受け付けるとクエリの実行を開始する。クラスタ20は、実行開始の指示を受け付けるとクエリの実行を開始する。DBサーバ100は、クエリ実行部140およびクラスタ20それぞれによるテーブル31a,31bのテーブルスキャンの進捗の監視を開始する。この場合、DBサーバ100は、複数の監視対象テーブルのうち、部分一致部分(テーブル31b,31c)と、新規部分(テーブル31d)とに対するテーブルスキャンを分けて監視する。
The
時刻T42において、DBサーバ100は、クエリ実行部140について、テーブル31bのスキャン進捗率90%、テーブル31cのスキャン進捗率70%、および、テーブル31dのスキャン進捗率100%を検出する。また、DBサーバ100は、クラスタ20について、テーブル31bのスキャン進捗率30%、テーブル31cのスキャン進捗率20%、および、テーブル31dのスキャン進捗率100%を検出する。
At time T42, the
この場合、複数の監視対象テーブルのうち、新規部分(テーブル31d)に対するスキャン進捗率がクエリ実行部140およびクラスタ20の両方で100%である。このため、DBサーバ100は、複数の監視対象テーブルのうちの部分一致部分(テーブル31b,31c)の現スキャン進捗率の差の絶対値を、オフロード選択テーブル111の部分一致タプルに登録されたスキャン進捗率の差の絶対値と比較する。
In this case, the scan progress rate for the new part (table 31d) among the plurality of monitoring target tables is 100% in both the
テーブル31bについて、現スキャン進捗率の差は、30%−90%=−60%である。したがって、テーブル31bについて、現スキャン進捗率の差の絶対値は60%である。テーブル31cについて、現スキャン進捗率の差は、20%−70%=−50%である。したがって、テーブル31cについて、現スキャン進捗率の差の絶対値は50%である。 For the table 31b, the difference in the current scan progress rate is 30% −90% = − 60%. Therefore, for the table 31b, the absolute value of the difference in the current scan progress rate is 60%. For the table 31c, the difference in the current scan progress rate is 20% −70% = − 50%. Therefore, for the table 31c, the absolute value of the difference in the current scan progress rate is 50%.
一方、オフロード選択テーブル111の部分一致タプルに含まれるテーブル31bのスキャン進捗率の差の絶対値は30%である。また、当該部分一致タプルに含まれるテーブル31cのスキャン進捗率の差の絶対値は50%である。 On the other hand, the absolute value of the difference in the scan progress rates of the table 31b included in the partial match tuple of the offload selection table 111 is 30%. Further, the absolute value of the difference in the scan progress rates of the table 31c included in the partial match tuple is 50%.
この場合、テーブル31bについて、現スキャン進捗率の差の絶対値(60%)≧部分一致タプルにおけるスキャン進捗率の差の絶対値(30%)を満たす。また、テーブル31cについて、現スキャン進捗率の差の絶対値(50%)≧部分一致タプルにおけるスキャン進捗率の差の絶対値(50%)を満たす。よって、DBサーバ100は、部分一致部分(テーブル31b,31c)の現スキャン進捗率の差の絶対値が、部分一致タプルに登録されたスキャン進捗率の差の絶対値以上であると判定する。
In this case, the absolute value (60%) of the difference in the current scan progress rate ≧ the absolute value (30%) of the difference in the scan progress rate in the partial match tuple is satisfied for the table 31b. For the table 31c, the absolute value (50%) of the difference in current scan progress rate ≧ the absolute value (50%) of the difference in scan progress rate in the partially matched tuple is satisfied. Therefore, the
更に、新規部分(テーブル31d)のスキャン進捗率が100%に達した依頼先は、部分一致タプルにおけるオフロード選択フラグ“FALSE”により特定される実行継続先であるクエリ実行部140(DBサーバ100)に一致している。このため、DBサーバ100は、複数の監視対象テーブルのうちの部分一致部分(テーブル31b,31c)のスキャン進捗率が低い方に、クエリの実行停止を指示する。この例では、クラスタ20によるテーブル31b,31cのスキャン進捗率の方が、クエリ実行部140によるテーブル31b,31cのスキャン進捗率よりも低い(例えば、前述のように、スキャン進捗率の平均値で比較してもよい)。したがって、DBサーバ100は、クラスタ20に、当該クエリの実行停止を指示する。クラスタ20は、実行停止の指示を受け付けると、当該クエリの実行を停止する。ここでは、未完了の監視対象処理に関する過去の実績から、オフロード選択フラグ“FALSE”により特定される実行継続先であるクエリ実行部140とは異なる方(クラスタ20)に対して、実行停止の指示が行われることが期待される。
Further, the request destination at which the scan progress rate of the new part (table 31d) has reached 100% is the query execution unit 140 (DB server 100) which is the execution continuation destination specified by the offload selection flag “FALSE” in the partial match tuple. ). For this reason, the
時刻T43において、クエリ実行部140は、クエリの実行を完了する。DBサーバ100は、クエリ実行部140からクエリの実行結果を取得し、クライアント600に送信する。
At time T43, the
このように、DBサーバ100は、クラスタ20におけるクエリ処理を、時刻T42で停止させることができる。その結果、時刻T42の段階で、クラスタ20における当該クエリ処理のためのリソースを解放させることができる。特に、過去の実績を用いることで、図13の場合に比べて、複数の監視対象テーブルの全てのスキャン進捗率が100%に到達する前に、ネイティブまたはアクセラレータのうちの一方のクエリの実行を停止させることができる。その結果、リソースの解放を一層早めることができる。
Thus, the
図17は、クエリ実行制御の第5の例を示す図である。図17の例では、DBサーバ100に入力されるクエリの内容は、テーブル31b(テーブル名“tbl2”)に対するインデックススキャン、テーブル31c(テーブル名“tbl3”)に対するインデックススキャン、および、テーブル31d(テーブル名“tbl4”)に対するシーケンシャルスキャンを含むとする。監視対象テーブルは、テーブル31b,31c,31dであるとする。
FIG. 17 is a diagram illustrating a fifth example of query execution control. In the example of FIG. 17, the contents of the query input to the
また、テーブル31b,31cそれぞれに対するインデックスキャン、および、テーブル31dに対するシーケンシャルスキャンを行ったクエリの過去の実績(入力されるクエリの内容に対する完全一致タプル)が、オフロード選択テーブル111に登録されていないものとする。更に、テーブル31bに対するインデックススキャンおよびテーブル31cに対するインデックススキャンを行ったクエリの過去の実績(入力されたクエリの内容に対する部分一致タプル)が、オフロード選択テーブル111に登録されているものとする。例えば、DBサーバ100は次の制御を行う。
In addition, past results of queries that have been index-scanned for each of the tables 31b and 31c and a sequential scan for the table 31d (a complete match tuple for the contents of the input query) are not registered in the offload selection table 111. Shall. Furthermore, it is assumed that the past results (partial match tuples for the contents of the input query) of the queries that have performed the index scan on the table 31b and the index scan on the table 31c are registered in the offload selection table 111. For example, the
時刻T51において、DBサーバ100は、クライアント600によるクエリの入力を受け付ける。DBサーバ100は、当該クエリがテーブル31b,31cそれぞれに対するインデックススキャン、および、テーブル31dに対するシーケンシャルスキャンを含むことを特定する。また、DBサーバ100は、当該クエリにおける監視対象テーブルをテーブル31b,31c,31dと決定する。DBサーバ100は、オフロード選択テーブル111を参照して、テーブル31b,31cそれぞれに対するシーケンシャルスキャンを行ったクエリの実績に対応する行を特定する。特定された行は、入力されたクエリの内容に対する部分一致タプルである。
At time T <b> 51, the
DBサーバ100は、DBサーバ100のクエリ実行部140およびクラスタ20の両方に、受け付けたクエリの実行開始を指示する。クエリ実行部140は、実行開始の指示を受け付けるとクエリの実行を開始する。クラスタ20は、実行開始の指示を受け付けるとクエリの実行を開始する。DBサーバ100は、クエリ実行部140およびクラスタ20それぞれによるテーブル31a,31bのテーブルスキャンの進捗の監視を開始する。この場合、DBサーバ100は、複数の監視対象テーブルのうち、部分一致部分(テーブル31b,31c)と、新規部分(テーブル31d)とに対するテーブルスキャンを分けて監視する。
The
時刻T52において、DBサーバ100は、クエリ実行部140について、テーブル31bのスキャン進捗率90%、テーブル31cのスキャン進捗率70%、および、テーブル31dのスキャン進捗率100%を検出する。また、DBサーバ100は、クラスタ20について、テーブル31bのスキャン進捗率30%、テーブル31cのスキャン進捗率20%、および、テーブル31dのスキャン進捗率40%を検出する。
At time T52, the
この場合、複数の監視対象テーブルのうち、新規部分(テーブル31d)に対するスキャン進捗率がクエリ実行部140で100%である。このため、DBサーバ100は、複数の監視対象テーブルのうちの部分一致部分(テーブル31b,31c)の現スキャン進捗率の差の絶対値を、オフロード選択テーブル111の部分一致タプルに登録されたスキャン進捗率の差の絶対値と比較する。
In this case, the scan progress rate for the new part (table 31d) among the plurality of monitoring target tables is 100% in the
テーブル31bについて、現スキャン進捗率の差は、30%−90%=−60%である。したがって、テーブル31bについて、現スキャン進捗率の差の絶対値は60%である。テーブル31cについて、現スキャン進捗率の差は、20%−70%=−50%である。したがって、テーブル31cについて、現スキャン進捗率の差の絶対値は50%である。 For the table 31b, the difference in the current scan progress rate is 30% −90% = − 60%. Therefore, for the table 31b, the absolute value of the difference in the current scan progress rate is 60%. For the table 31c, the difference in the current scan progress rate is 20% −70% = − 50%. Therefore, for the table 31c, the absolute value of the difference in the current scan progress rate is 50%.
一方、オフロード選択テーブル111の部分一致タプルに含まれるテーブル31bのスキャン進捗率の差の絶対値は30%である。また、当該部分一致タプルに含まれるテーブル31cのスキャン進捗率の差の絶対値は50%である。 On the other hand, the absolute value of the difference in the scan progress rates of the table 31b included in the partial match tuple of the offload selection table 111 is 30%. Further, the absolute value of the difference in the scan progress rates of the table 31c included in the partial match tuple is 50%.
この場合、テーブル31bについて、現スキャン進捗率の差の絶対値(60%)≧部分一致タプルにおけるスキャン進捗率の差の絶対値(30%)を満たす。また、テーブル31cについて、現スキャン進捗率の差の絶対値(50%)≧部分一致タプルにおけるスキャン進捗率の差の絶対値(50%)を満たす。よって、DBサーバ100は、部分一致部分(テーブル31b,31c)の現スキャン進捗率の差の絶対値が、部分一致タプルに登録されたスキャン進捗率の差の絶対値以上であると判定する。
In this case, the absolute value (60%) of the difference in the current scan progress rate ≧ the absolute value (30%) of the difference in the scan progress rate in the partial match tuple is satisfied for the table 31b. For the table 31c, the absolute value (50%) of the difference in current scan progress rate ≧ the absolute value (50%) of the difference in scan progress rate in the partially matched tuple is satisfied. Therefore, the
更に、新規部分(テーブル31d)のスキャン進捗率が100%に達した依頼先は、部分一致タプルにおけるオフロード選択フラグ“FALSE”により特定される実行継続先であるクエリ実行部140(DBサーバ100)に一致している。このため、DBサーバ100は、複数の監視対象テーブルのうちの部分一致部分(テーブル31b,31c)のスキャン進捗率が低い方に、クエリの実行停止を指示する。この例では、クラスタ20によるテーブル31b,31cのスキャン進捗率の方が、クエリ実行部140によるテーブル31b,31cのスキャン進捗率よりも低い(例えば、前述のように、スキャン進捗率の平均値で比較してもよい)。したがって、DBサーバ100は、クラスタ20に、当該クエリの実行停止を指示する。クラスタ20は、実行停止の指示を受け付けると、当該クエリの実行を停止する。ここでは、未完了の監視対象処理に関する過去の実績から、オフロード選択フラグ“FALSE”により特定される実行継続先であるクエリ実行部140とは異なる方(クラスタ20)に対して、実行停止の指示が行われることが期待される。
Further, the request destination at which the scan progress rate of the new part (table 31d) has reached 100% is the query execution unit 140 (DB server 100) which is the execution continuation destination specified by the offload selection flag “FALSE” in the partial match tuple. ). For this reason, the
時刻T53において、クエリ実行部140は、クエリの実行を完了する。DBサーバ100は、クエリ実行部140からクエリの実行結果を取得し、クライアント600に送信する。
At time T53, the
このように、DBサーバ100は、クラスタ20におけるクエリ処理を、時刻T52で停止させることができる。その結果、時刻T52の段階で、クラスタ20における当該クエリ処理のためのリソースを解放させることができる。特に、過去の実績を用いることで、図13の場合に比べて、複数の監視対象テーブルの全てのスキャン進捗率が100%に到達する前に、ネイティブまたはアクセラレータのうちの一方のクエリの実行を停止させることができる。その結果、リソースの解放を一層早めることができる。
Thus, the
特に、DBサーバ100において、テーブル31dのスキャン進捗率が100%に到達していれば、クラスタ20においてテーブル31dのスキャン進捗率が100%に到達していなくても、クラスタ20によるクエリの実行を停止させることができる。したがって、リソースの解放を一層早めることができる。
In particular, in the
図18は、クエリ実行制御の第6の例を示す図である。図18の例では、DBサーバ100に入力されるクエリの内容は、テーブル31b(テーブル名“tbl2”)に対するインデックススキャン、テーブル31c(テーブル名“tbl3”)に対するインデックススキャン、および、テーブル31d(テーブル名“tbl4”)に対するシーケンシャルスキャンを含むとする。監視対象テーブルは、テーブル31b,31c,31dであるとする。
FIG. 18 is a diagram illustrating a sixth example of query execution control. In the example of FIG. 18, the contents of the query input to the
また、テーブル31b,31cそれぞれに対するインデックスキャン、および、テーブル31dに対するシーケンシャルスキャンを行ったクエリの過去の実績(入力されるクエリの内容に対する完全一致タプル)が、オフロード選択テーブル111に登録されていないものとする。更に、テーブル31bに対するインデックススキャンおよびテーブル31cに対するインデックススキャンを行ったクエリの過去の実績(入力されたクエリの内容に対する部分一致タプル)が、オフロード選択テーブル111に登録されているものとする。例えば、DBサーバ100は次の制御を行う。
In addition, past results of queries that have been index-scanned for each of the tables 31b and 31c and a sequential scan for the table 31d (a complete match tuple for the contents of the input query) are not registered in the offload selection table 111. Shall. Furthermore, it is assumed that the past results (partial match tuples for the contents of the input query) of the queries that have performed the index scan on the table 31b and the index scan on the table 31c are registered in the offload selection table 111. For example, the
時刻T61において、DBサーバ100は、クライアント600によるクエリの入力を受け付ける。DBサーバ100は、当該クエリがテーブル31b,31cそれぞれに対するインデックススキャン、および、テーブル31dに対するシーケンシャルスキャンを含むことを特定する。また、DBサーバ100は、当該クエリにおける監視対象テーブルをテーブル31b,31c,31dと決定する。DBサーバ100は、オフロード選択テーブル111を参照して、テーブル31b,31cそれぞれに対するシーケンシャルスキャンを行ったクエリの実績に対応する行を特定する。特定された行は、入力されたクエリの内容に対する部分一致タプルである。
At time T <b> 61, the
DBサーバ100は、DBサーバ100のクエリ実行部140およびクラスタ20の両方に、受け付けたクエリの実行開始を指示する。クエリ実行部140は、実行開始の指示を受け付けるとクエリの実行を開始する。クラスタ20は、実行開始の指示を受け付けるとクエリの実行を開始する。DBサーバ100は、クエリ実行部140およびクラスタ20それぞれによるテーブル31a,31bのテーブルスキャンの進捗の監視を開始する。この場合、DBサーバ100は、複数の監視対象テーブルのうち、部分一致部分(テーブル31b,31c)と、新規部分(テーブル31d)とに対するテーブルスキャンを分けて監視する。
The
時刻T62において、DBサーバ100は、クエリ実行部140について、テーブル31bのスキャン進捗率90%、テーブル31cのスキャン進捗率70%、および、テーブル31dのスキャン進捗率60%を検出する。また、DBサーバ100は、クラスタ20について、テーブル31bのスキャン進捗率30%、テーブル31cのスキャン進捗率20%、および、テーブル31dのスキャン進捗率100%を検出する。
At time T62, the
この場合、複数の監視対象テーブルのうち、新規部分(テーブル31d)に対するスキャン進捗率がクラスタ20で100%である。このため、DBサーバ100は、複数の監視対象テーブルのうちの部分一致部分(テーブル31b,31c)の現スキャン進捗率の差の絶対値を、オフロード選択テーブル111の部分一致タプルに登録されたスキャン進捗率の差の絶対値と比較する。
In this case, the scan progress rate for the new part (table 31d) among the plurality of monitoring target tables is 100% in the
テーブル31bについて、現スキャン進捗率の差は、30%−90%=−60%である。したがって、テーブル31bについて、現スキャン進捗率の差の絶対値は60%である。テーブル31cについて、現スキャン進捗率の差は、20%−70%=−50%である。したがって、テーブル31cについて、現スキャン進捗率の差の絶対値は50%である。 For the table 31b, the difference in the current scan progress rate is 30% −90% = − 60%. Therefore, for the table 31b, the absolute value of the difference in the current scan progress rate is 60%. For the table 31c, the difference in the current scan progress rate is 20% −70% = − 50%. Therefore, for the table 31c, the absolute value of the difference in the current scan progress rate is 50%.
一方、オフロード選択テーブル111の部分一致タプルに含まれるテーブル31bのスキャン進捗率の差の絶対値は30%である。また、当該部分一致タプルに含まれるテーブル31cのスキャン進捗率の差の絶対値は50%である。 On the other hand, the absolute value of the difference in the scan progress rates of the table 31b included in the partial match tuple of the offload selection table 111 is 30%. Further, the absolute value of the difference in the scan progress rates of the table 31c included in the partial match tuple is 50%.
この場合、テーブル31bについて、現スキャン進捗率の差の絶対値(60%)≧部分一致タプルにおけるスキャン進捗率の差の絶対値(30%)を満たす。また、テーブル31cについて、現スキャン進捗率の差の絶対値(50%)≧部分一致タプルにおけるスキャン進捗率の差の絶対値(50%)を満たす。よって、DBサーバ100は、部分一致部分(テーブル31b,31c)の現スキャン進捗率の差の絶対値が、部分一致タプルに登録されたスキャン進捗率の差の絶対値以上であると判定する。
In this case, the absolute value (60%) of the difference in the current scan progress rate ≧ the absolute value (30%) of the difference in the scan progress rate in the partial match tuple is satisfied for the table 31b. For the table 31c, the absolute value (50%) of the difference in current scan progress rate ≧ the absolute value (50%) of the difference in scan progress rate in the partially matched tuple is satisfied. Therefore, the
更に、新規部分(テーブル31d)のスキャン進捗率が100%に達した依頼先は、クラスタ20である。クラスタ20は、部分一致タプルにおけるオフロード選択フラグ“FALSE”により特定される実行継続先であるクエリ実行部140(DBサーバ100)に一致していない。このため、DBサーバ100は、時刻T62の段階では、クエリ実行部140およびクラスタ20の両方によるクエリ処理を継続させると判定し、各監視対象テーブルのテーブルスキャンの監視を継続する。この段階では、ネイティブおよびアクセラレータの何れの方が全ての監視対象処理を早く完了できるかを適切に判定できないからである。すなわち、この段階では、クエリ実行部140によるテーブル31dのスキャン(比較的大きな負荷の処理)が完了していないため、今後、クエリ実行部140によるテーブル31b,31cのスキャンに、過去の実績よりも時間がかかる可能性を否定できない。したがって、このような場合には、DBサーバ100は、両方のクエリ処理を継続させ、スキャン進捗率の監視を継続する。
Furthermore, the
こうして、何れによるクエリ処理を停止させれば有利であるかを判定できない場合には、両方によるクエリ処理を継続し、監視を継続することで、適切なタイミングで、ネイティブおよびアクセラレータの何れかによるクエリ処理を停止させることができる。 In this way, if it is not possible to determine which query processing is advantageous, it is possible to continue query processing by both and continue monitoring so that queries by either native or accelerator can be performed at an appropriate timing. Processing can be stopped.
図19は、リソース解放のタイミングの例を示す図である。図19(A)は、アクセラレータ側のクエリの実行を停止させる場合を例示している。図19(B)は、ネイティブ側のクエリの実行を停止させる場合を例示している。 FIG. 19 is a diagram illustrating an example of resource release timing. FIG. 19A illustrates a case where execution of a query on the accelerator side is stopped. FIG. 19B illustrates a case where execution of a query on the native side is stopped.
図19(A)の例でいえば、時刻T71に、ネイティブおよびアクセラレータの両方がクエリの実行を開始する。そして、時刻T72に、アクセラレータ側のクエリの実行が停止される。更に、時刻T73に、ネイティブ側のクエリの実行が完了する。このように、ネイティブ側のクエリの実行が完了する時刻T73よりも前の時刻T72に、アクセラレータ側のクエリの実行が停止される。こうして、アクセラレータ側のクエリ処理に伴うリソースを、時刻T72において解放させることができる。特に、テーブルスキャンというクエリの初期段階に実行される処理を進捗の監視対象とすることで、アクセラレータ側のクエリの実行を初期段階で停止させることができ、比較的早い段階でリソースを解放させることができる。 In the example of FIG. 19A, both the native and the accelerator start executing a query at time T71. Then, at time T72, the execution of the query on the accelerator side is stopped. Further, at time T73, execution of the native-side query is completed. In this way, the execution of the accelerator-side query is stopped at time T72 before the time T73 when the execution of the native-side query is completed. In this way, resources associated with accelerator side query processing can be released at time T72. In particular, the processing executed at the initial stage of a query called table scan can be monitored for progress, so that the execution of queries on the accelerator side can be stopped at the initial stage, and resources can be released at a relatively early stage. Can do.
図19(B)の例でいえば、時刻T71aに、ネイティブおよびアクセラレータの両方がクエリの実行を開始する。そして、時刻T72aに、ネイティブ側のクエリの実行が停止される。更に、時刻T73aに、アクセラレータ側のクエリの実行が完了する。このように、アクセラレータ側のクエリの実行が完了する時刻T73aよりも前の時刻T72aに、ネイティブ側のクエリの実行が停止される。こうして、ネイティブ側のクエリ処理に伴うリソースを、時刻T72aにおいて解放させることができる。図19(A)の場合と同様に、テーブルスキャンを進捗の監視対象とすることで、ネイティブ側のクエリの実行を初期段階で停止させることができ、比較的早い段階でリソースを解放させることができる。 In the example of FIG. 19B, both the native and the accelerator start executing the query at time T71a. At time T72a, execution of the native-side query is stopped. Further, at time T73a, the execution of the query on the accelerator side is completed. As described above, the execution of the query on the native side is stopped at the time T72a before the time T73a at which the execution of the query on the accelerator side is completed. In this way, resources associated with native-side query processing can be released at time T72a. As in the case of FIG. 19A, by executing the table scan as the progress monitoring target, it is possible to stop the execution of the query on the native side at the initial stage and to release the resource at a relatively early stage. it can.
一方、DBサーバ100によるクエリ実行制御を行わない方法も考えられる。
図20は、リソース解放のタイミングの比較例を示す図である。図20では、ネイティブおよびアクセラレータのうち、何れか一方がクエリに含まれる全ての処理を完了した段階で、他方のクエリの実行を停止させる例である。図20(A)は、アクセラレータ側のクエリの実行を停止させる場合を示している。図20(B)は、ネイティブ側のクエリの実行を停止させる場合を示している。
On the other hand, a method in which the
FIG. 20 is a diagram illustrating a comparative example of resource release timing. FIG. 20 shows an example in which execution of the other query is stopped when one of the native and accelerators completes all the processes included in the query. FIG. 20A shows a case where execution of the query on the accelerator side is stopped. FIG. 20B shows a case where execution of a query on the native side is stopped.
図20(A)の例でいえば、時刻T81に、ネイティブおよびアクセラレータの両方がクエリの実行を開始する。そして、時刻T82に、ネイティブ側のクエリの実行が完了する。このため、時刻T82に、未完了であるアクセラレータ側のクエリの実行が停止される。 In the example of FIG. 20A, both the native and the accelerator start executing the query at time T81. At time T82, the execution of the native query is completed. For this reason, at time T82, execution of the incomplete accelerator-side query is stopped.
図20(B)の例でいえば、時刻T81aに、ネイティブおよびアクセラレータの両方がクエリの実行を開始する。そして、時刻T82aに、アクセラレータ側のクエリの実行が完了する。このため、時刻T82aに、未完了であるネイティブ側のクエリの実行が停止される。 In the example of FIG. 20B, both the native and the accelerator start executing the query at time T81a. Then, at time T82a, execution of the query on the accelerator side is completed. For this reason, at time T82a, execution of the incomplete native-side query is stopped.
図20(A)および図20(B)の何れの例においても、一方のクエリの実行が完了するまで、他方のクエリの実行が継続される。このため、一方でクエリの実行が完了するまで、他方によるクエリ処理に伴うリソースの使用は継続され、リソース解放のタイミングが遅い。すなわち、図20(A)および図20(B)の例では、リソースを余計に使用する期間が長くなる。 In both the examples of FIGS. 20A and 20B, the execution of the other query is continued until the execution of the one query is completed. For this reason, until the execution of the query is completed on the one hand, the use of resources accompanying the query processing by the other is continued, and the resource release timing is delayed. That is, in the example of FIG. 20A and FIG. 20B, the period during which the resources are used excessively becomes longer.
一方、DBサーバ100のクエリ実行制御によれば、前述のように、ネイティブおよびアクセラレータのうちの一方でクエリの実行が完了するよりも前に、他方のクエリの実行を停止させることができる。したがって、一方でクエリの実行が完了した後に、他方のクエリの実行を停止させるよりも、他方のクエリの実行の停止を早めることができる。その結果、他方によるクエリ処理に伴うリソースを、より早く解放させることができる。そして、解放されたリソースを、別の処理に活用可能となる。また、クエリの実行の停止を早めることで、クエリ処理に伴う消費電力の低減を図れる。
On the other hand, according to the query execution control of the
こうして、情報処理システムによるクエリに対する応答性能を高めながら、ネイティブおよびアクセラレータによるリソース利用の効率化を図れる。
なお、第1の実施の形態の情報処理は、処理部1bにプログラムを実行させることで実現できる。また、第2の実施の形態の情報処理は、プロセッサ101にプログラムを実行させることで実現できる。プログラムは、コンピュータ読み取り可能な記録媒体13に記録できる。
In this way, it is possible to improve the resource utilization efficiency by the native and accelerator while improving the response performance to the query by the information processing system.
The information processing according to the first embodiment can be realized by causing the
例えば、プログラムを記録した記録媒体13を配布することで、プログラムを流通させることができる。また、プログラムを他のコンピュータに格納しておき、ネットワーク経由でプログラムを配布してもよい。コンピュータは、例えば、記録媒体13に記録されたプログラムまたは他のコンピュータから受信したプログラムを、RAM102やHDD103などの記憶装置に格納し(インストールし)、当該記憶装置からプログラムを読み込んで実行してもよい。
For example, the program can be distributed by distributing the
以上の第1,第2の実施の形態を含む実施形態に関し、更に以下の付記を開示する。
(付記1) クエリに含まれる複数の処理による処理対象のデータを記憶する記憶部と、
前記記憶部に記憶された前記データに基づいて前記複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定し、第1の装置および第2の装置の両方に前記クエリの実行開始を指示し、前記第1の装置により実行される前記監視対象処理の第1の進捗情報を取得し、前記第2の装置により実行される前記監視対象処理の第2の進捗情報を取得し、前記第1の進捗情報および前記第2の進捗情報に基づいて、前記第1の装置および前記第2の装置のうちの1の装置に前記クエリの実行停止を指示する処理部と、
を有する情報処理装置。
Regarding the embodiments including the first and second embodiments, the following additional notes are disclosed.
(Supplementary Note 1) A storage unit that stores data to be processed by a plurality of processes included in a query;
Based on the data stored in the storage unit, a monitoring target process that is estimated to have a processing load larger than a predetermined load among the plurality of processes is determined, and both the first device and the second device are determined. The execution start of the query is instructed, the first progress information of the monitoring target process executed by the first device is acquired, and the second progress of the monitoring target process executed by the second device A processing unit for acquiring information and instructing one of the first device and the second device to stop executing the query based on the first progress information and the second progress information When,
An information processing apparatus.
(付記2) 前記処理部は、前記監視対象処理に対して、前記第1の装置および前記第2の装置のうちの前記実行停止を指示した方を識別可能な識別情報を前記記憶部に格納し、前記監視対象処理を含む他のクエリを受け付けると、前記記憶部に記憶された前記識別情報に基づいて、前記第1の装置および前記第2の装置の何れか一方に、前記他のクエリの実行開始を指示する、付記1記載の情報処理装置。
(Additional remark 2) The said process part stores the identification information which can identify the direction which instruct | indicated the said execution stop among the said 1st apparatus and the said 2nd apparatus with respect to the said monitoring object process in the said memory | storage part. When another query including the monitoring target process is received, the other query is sent to one of the first device and the second device based on the identification information stored in the storage unit. The information processing apparatus according to
(付記3) 前記処理部は、前記クエリに含まれる前記監視対象処理が前記他のクエリに含まれる複数の監視対象処理のうちの第1の部分に一致する場合、前記第1および前記第2の装置の両方に前記他のクエリの実行開始を指示し、前記第1および前記第2の装置それぞれの前記第1の部分に対する進捗と、前記複数の監視対象処理のうちの前記第1の部分とは異なる第2の部分に対する前記第1および前記第2の装置それぞれの進捗とに基づいて、前記第1および前記第2の装置のうちの1の装置に前記他のクエリの実行停止を指示する、付記2記載の情報処理装置。
(Supplementary Note 3) When the monitoring target process included in the query matches a first part of a plurality of monitoring target processes included in the other query, the processing unit includes the first and second Instructing both of the devices to start execution of the other query, the progress of the first portion of each of the first and second devices, and the first portion of the plurality of monitoring target processes Instructing one of the first and second devices to stop executing the other query based on the progress of each of the first and second devices with respect to a second part different from The information processing apparatus according to
(付記4) 前記処理部は、前記第1および前記第2の装置の両方により前記第1の部分の実行が完了すると、前記第1の装置により実行される前記第2の部分に対する第3の進捗情報と前記第2の装置により実行される前記第2の部分に対する第4の進捗情報とに基づいて、前記第1および前記第2の装置のうちの1の装置に前記他のクエリの実行停止を指示する、付記3記載の情報処理装置。
(Supplementary Note 4) When the execution of the first part is completed by both the first and second devices, the processing unit performs a third operation on the second part executed by the first device. Execution of the other query to one of the first and second devices based on progress information and fourth progress information for the second portion executed by the second device The information processing apparatus according to
(付記5) 前記処理部は、前記第1および前記第2の装置の両方または何れか一方により前記第2の部分の実行が完了すると、前記第1の装置により実行される前記第1の部分に対する第5の進捗情報と前記第2の装置により実行される前記第1の部分に対する第6の進捗情報と前記識別情報とに基づいて、前記第1および前記第2の装置のうちの1の装置に前記他のクエリの実行停止を指示する、付記3または4記載の情報処理装置。
(Supplementary Note 5) When the execution of the second part is completed by either or one of the first and second devices, the processing unit is executed by the first device. One of the first and second devices based on the fifth progress information for and the sixth progress information and the identification information for the first portion executed by the second device. The information processing apparatus according to
(付記6) 前記処理部は、前記複数の処理により用いられる複数のデータセットそれぞれの情報量に基づいて前記複数の処理それぞれの前記処理負荷を決定する、付記1乃至5の何れか1つに記載の情報処理装置。 (Supplementary Note 6) The processing unit may determine the processing load of each of the plurality of processes based on an information amount of each of the plurality of data sets used by the plurality of processes. The information processing apparatus described.
(付記7) 前記処理部は、前記複数のデータセットのうち、最大の情報量であるデータセットに対する処理を第1の監視対象処理と決定し、前記最大の情報量に基づいて第2の監視対象処理を決定する、付記6記載の情報処理装置。 (Additional remark 7) The said process part determines the process with respect to the data set which is the largest information amount among these data sets as a 1st monitoring object process, and performs 2nd monitoring based on the said largest information amount. The information processing apparatus according to attachment 6, wherein the target process is determined.
(付記8) 前記データセットは、関係データベースにおけるテーブルであり、
前記処理部は、前記テーブルの行数に基づいて前記情報量を取得する、
付記6または7記載の情報処理装置。
(Appendix 8) The data set is a table in a relational database,
The processing unit acquires the information amount based on the number of rows in the table.
The information processing apparatus according to appendix 6 or 7.
(付記9) 前記処理部は、前記クエリに含まれる前記複数の処理それぞれのうち、第1の処理よりも先に実行される第2の処理を前記監視対象処理と決定し、前記第1の処理を前記監視対象処理としない、付記1乃至8の何れか1つに記載の情報処理装置。
(Additional remark 9) The said process part determines the 2nd process performed prior to a 1st process among each of the said several processes contained in the said query as the said monitoring object process, The said 1st The information processing apparatus according to any one of
(付記10) 前記クエリは、関係データベースにおけるテーブルに対する複数の処理を含み、
前記第2の処理は、前記テーブルに対するテーブルスキャンである、
付記9記載の情報処理装置。
(Supplementary Note 10) The query includes a plurality of processes for tables in a relational database,
The second process is a table scan for the table.
The information processing apparatus according to appendix 9.
(付記11) クエリに含まれる複数の処理による処理対象のデータに基づいて、前記複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定し、
第1の装置および第2の装置の両方に前記クエリの実行開始を指示し、
前記第1の装置により実行される前記監視対象処理の第1の進捗情報を取得し、前記第2の装置により実行される前記監視対象処理の第2の進捗情報を取得し、
前記第1の進捗情報および前記第2の進捗情報に基づいて、前記第1の装置および前記第2の装置のうちの1の装置に前記クエリの実行停止を指示する、
処理をコンピュータに実行させるプログラム。
(Additional remark 11) Based on the data of the process target by the some process contained in a query, the monitoring object process estimated that a process load is larger than predetermined | prescribed load among these processes is determined,
Instructing both the first device and the second device to start executing the query;
Obtaining first progress information of the monitoring target process executed by the first device; obtaining second progress information of the monitoring target process executed by the second device;
Instructing one of the first device and the second device to stop execution of the query based on the first progress information and the second progress information.
A program that causes a computer to execute processing.
(付記12) コンピュータが、
クエリに含まれる複数の処理による処理対象のデータに基づいて、前記複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定し、
第1の装置および第2の装置の両方に前記クエリの実行開始を指示し、
前記第1の装置により実行される前記監視対象処理の第1の進捗情報を取得し、前記第2の装置により実行される前記監視対象処理の第2の進捗情報を取得し、
前記第1の進捗情報および前記第2の進捗情報に基づいて、前記第1の装置および前記第2の装置のうちの1の装置に前記クエリの実行停止を指示する、
情報処理方法。
(Supplementary note 12)
Based on data to be processed by a plurality of processes included in the query, a monitoring target process that is estimated to have a processing load larger than a predetermined load among the plurality of processes is determined.
Instructing both the first device and the second device to start executing the query;
Obtaining first progress information of the monitoring target process executed by the first device; obtaining second progress information of the monitoring target process executed by the second device;
Instructing one of the first device and the second device to stop execution of the query based on the first progress information and the second progress information.
Information processing method.
1 情報処理装置
1a 記憶部
1b 処理部
2 第1の装置
3 第2の装置
4 端末装置
5 記憶装置
6 ネットワーク
D1 処理対象データ
Q1 クエリ
DESCRIPTION OF
Claims (7)
前記記憶部に記憶された前記データに基づいて前記複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定し、第1の装置および第2の装置の両方に前記クエリの実行開始を指示し、前記第1の装置により実行される前記監視対象処理の第1の進捗情報を取得し、前記第2の装置により実行される前記監視対象処理の第2の進捗情報を取得し、前記第1の進捗情報および前記第2の進捗情報に基づいて、前記第1の装置および前記第2の装置のうちの1の装置に前記クエリの実行停止を指示する処理部と、
を有する情報処理装置。 A storage unit for storing data to be processed by a plurality of processes included in the query;
Based on the data stored in the storage unit, a monitoring target process that is estimated to have a processing load larger than a predetermined load among the plurality of processes is determined, and both the first device and the second device are determined. The execution start of the query is instructed, the first progress information of the monitoring target process executed by the first device is acquired, and the second progress of the monitoring target process executed by the second device A processing unit for acquiring information and instructing one of the first device and the second device to stop executing the query based on the first progress information and the second progress information When,
An information processing apparatus.
第1の装置および第2の装置の両方に前記クエリの実行開始を指示し、
前記第1の装置により実行される前記監視対象処理の第1の進捗情報を取得し、前記第2の装置により実行される前記監視対象処理の第2の進捗情報を取得し、
前記第1の進捗情報および前記第2の進捗情報に基づいて、前記第1の装置および前記第2の装置のうちの1の装置に前記クエリの実行停止を指示する、
処理をコンピュータに実行させるプログラム。 Based on data to be processed by a plurality of processes included in the query, a monitoring target process that is estimated to have a processing load larger than a predetermined load among the plurality of processes is determined.
Instructing both the first device and the second device to start executing the query;
Obtaining first progress information of the monitoring target process executed by the first device; obtaining second progress information of the monitoring target process executed by the second device;
Instructing one of the first device and the second device to stop execution of the query based on the first progress information and the second progress information.
A program that causes a computer to execute processing.
クエリに含まれる複数の処理による処理対象のデータに基づいて、前記複数の処理のうち処理負荷が所定の負荷よりも大きいと推定される監視対象処理を決定し、
第1の装置および第2の装置の両方に前記クエリの実行開始を指示し、
前記第1の装置により実行される前記監視対象処理の第1の進捗情報を取得し、前記第2の装置により実行される前記監視対象処理の第2の進捗情報を取得し、
前記第1の進捗情報および前記第2の進捗情報に基づいて、前記第1の装置および前記第2の装置のうちの1の装置に前記クエリの実行停止を指示する、
情報処理方法。 Computer
Based on data to be processed by a plurality of processes included in the query, a monitoring target process that is estimated to have a processing load larger than a predetermined load among the plurality of processes is determined.
Instructing both the first device and the second device to start executing the query;
Obtaining first progress information of the monitoring target process executed by the first device; obtaining second progress information of the monitoring target process executed by the second device;
Instructing one of the first device and the second device to stop execution of the query based on the first progress information and the second progress information.
Information processing method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017014518A JP2018124658A (en) | 2017-01-30 | 2017-01-30 | Information processing device, program and information processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017014518A JP2018124658A (en) | 2017-01-30 | 2017-01-30 | Information processing device, program and information processing method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2018124658A true JP2018124658A (en) | 2018-08-09 |
Family
ID=63111402
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2017014518A Pending JP2018124658A (en) | 2017-01-30 | 2017-01-30 | Information processing device, program and information processing method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2018124658A (en) |
-
2017
- 2017-01-30 JP JP2017014518A patent/JP2018124658A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10691722B2 (en) | Consistent query execution for big data analytics in a hybrid database | |
US20160212206A1 (en) | Deterministic database system and data transferring method thereof | |
US20150234896A1 (en) | Adaptive distribution method for hash operations | |
US11475006B2 (en) | Query and change propagation scheduling for heterogeneous database systems | |
US10152500B2 (en) | Read mostly instances | |
JP4571609B2 (en) | Resource allocation method, resource allocation program, and management computer | |
US10747777B2 (en) | Computer system and transaction processing management method | |
US11860833B2 (en) | Data redistribution method, apparatus, and system | |
US8510280B2 (en) | System, method, and computer-readable medium for dynamic detection and management of data skew in parallel join operations | |
US9251227B2 (en) | Intelligently provisioning cloud information services | |
WO2019109854A1 (en) | Data processing method and device for distributed database, storage medium, and electronic device | |
JP7174377B2 (en) | Database management system and anonymization processing method | |
US20230418811A1 (en) | Transaction processing method and apparatus, computing device, and storage medium | |
TW201738781A (en) | Method and device for joining tables | |
CN111581234A (en) | RAC multi-node database query method, device and system | |
US11645281B1 (en) | Caching query plans in database systems | |
US11216421B2 (en) | Extensible streams for operations on external systems | |
US20180267831A1 (en) | Information processing apparatus, stage-out processing method and recording medium recording job management program | |
US8832157B1 (en) | System, method, and computer-readable medium that facilitates efficient processing of distinct counts on several columns in a parallel processing system | |
US11461274B2 (en) | Processing streams on external data sources | |
JP2018124658A (en) | Information processing device, program and information processing method | |
US20220035813A1 (en) | Query optimization method and apparatus | |
CN114328466A (en) | Data cold and hot storage method and device and electronic equipment | |
CN110168514B (en) | Transaction processing method, device and equipment | |
CN111813761A (en) | Database management method and device and computer storage medium |