JP2019106039A - Database management device, database management method, and database management program - Google Patents

Database management device, database management method, and database management program Download PDF

Info

Publication number
JP2019106039A
JP2019106039A JP2017238546A JP2017238546A JP2019106039A JP 2019106039 A JP2019106039 A JP 2019106039A JP 2017238546 A JP2017238546 A JP 2017238546A JP 2017238546 A JP2017238546 A JP 2017238546A JP 2019106039 A JP2019106039 A JP 2019106039A
Authority
JP
Japan
Prior art keywords
view
unit
databases
database management
database
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.)
Granted
Application number
JP2017238546A
Other languages
Japanese (ja)
Other versions
JP6898215B2 (en
Inventor
茂莉 黒川
Mori Kurokawa
茂莉 黒川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
KDDI Corp
Original Assignee
KDDI Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by KDDI Corp filed Critical KDDI Corp
Priority to JP2017238546A priority Critical patent/JP6898215B2/en
Publication of JP2019106039A publication Critical patent/JP2019106039A/en
Application granted granted Critical
Publication of JP6898215B2 publication Critical patent/JP6898215B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

To improve execution performance of an inquiry sentence in an environment where a plurality of databases are used.SOLUTION: A database management device 2 stores a physical model for managing a storage destination of a plurality of tables included in each of a plurality of databases 11 and a logical model for managing a virtual table including a view of the table to which a user refers, and acquires a plurality of inquiry sentences corresponding to at least any of the plurality of databases 11, and specifies a sub-inquiry for referring to the plurality of databases 11 among sub-inquiries commonly included in at least a part of the plurality of acquired inquire sentences on the basis of the physical model and the logical model, and creates a materialized view corresponding to the specified sub-inquiry, and updates the logical model and the physical model such that the user can refer to the created materialized view.SELECTED DRAWING: Figure 1

Description

本発明は、データベース管理装置、データベース管理方法及びデータベース管理プログラムに関する。   The present invention relates to a database management apparatus, a database management method, and a database management program.

従来、データ仮想化技術を用いることにより、複数のデータベースシステム(以下、データベースという。)を仮想的に統合したデータ統合環境を構築することが行われている。   2. Description of the Related Art Conventionally, it has been practiced to construct a data integration environment in which a plurality of database systems (hereinafter referred to as databases) are virtually integrated by using data virtualization technology.

データ統合環境では、データベースに格納されているテーブルを示す情報であるスキーマ情報を物理モデルと論理モデルで表現する。物理モデルでは、テーブルの物理的な格納先を示すとともに、テーブルが格納されているデータベースに接続するための接続情報を保持する。論理モデルでは、一以上の物理モデル又は論理モデルに対応する仮想テーブルを構成する。クライアントは仮想テーブルを参照して問合せ文を実行することにより、テーブルが配置されているデータベースを意識することなく問合せ文を実行することができる。   In a data integration environment, schema information, which is information indicating a table stored in a database, is represented by a physical model and a logical model. The physical model indicates the physical storage destination of the table and holds connection information for connecting to the database in which the table is stored. Logical models construct virtual tables that correspond to one or more physical models or logical models. The client executes the query statement by referring to the virtual table, so that the query statement can be executed without being aware of the database in which the table is arranged.

データ統合環境では、ユーザから受け付けた問合せ文を処理する処理装置が、問合せ文の実行時に必要となるテーブルをデータベースからネットワークを介して取得し、取得したテーブルを用いて問合せ文を実行する。したがって、データ統合環境における問合せ文の実行性能は、データ通信量に依存する。このため、データ通信量を減らすことにより、データ統合環境における問合せ文の実行性能を改善することができる。   In the data integration environment, a processing device that processes a query sentence received from a user acquires a table necessary for executing the query sentence from the database via the network, and executes the query sentence using the acquired table. Therefore, the execution performance of a query statement in a data integration environment depends on the amount of data communication. Therefore, by reducing the amount of data communication, it is possible to improve the execution performance of the query statement in the data integration environment.

非特許文献1には、データ通信量を減らす方法として、問合せ文の実行時に、問合せ文に対応する処理を、当該問合せ文に対応するテーブルを格納するデータベース上で行う方法が開示されている。しかしながら、問合せ文が複数のデータベースのそれぞれに格納されているテーブルを参照する場合、非特許文献1に記載の方法では、データベースにおける処理が限定され、通信量を効率的に削減できないという問題がある。   Non-Patent Document 1 discloses, as a method of reducing the amount of data communication, a method of performing processing corresponding to a query sentence on a database storing a table corresponding to the query sentence when executing the query sentence. However, when the query statement refers to a table stored in each of a plurality of databases, the method described in Non-Patent Document 1 has a problem that the processing in the databases is limited and the amount of communication can not be reduced efficiently. .

このような問題に対して、特許文献1では、問合せ文の実行時に、複数のデータベースのそれぞれに格納されているテーブルを参照する場合、データ量が小さいテーブルを一時的に一方のデータベースに移動した後、当該データベース上で、問合せ文に対応する処理を行う方法が開示されている。   With regard to such a problem, in Patent Document 1, when referring to a table stored in each of a plurality of databases at the time of executing a query statement, a table with a small amount of data is temporarily moved to one of the databases After that, a method of performing processing corresponding to a query sentence on the database is disclosed.

また、特許文献2では、大規模データの分散処理を管理するフレームワークであるHadoop(登録商標)とデータベースとの連携において、問合せ処理に係る中間生成物をHadoop上に生成しておき、当該中間生成物を用いることにより問合せ処理を効率化する方法が開示されている。   Further, in Patent Document 2, in cooperation with Hadoop (registered trademark), which is a framework for managing distributed processing of large-scale data, and a database, an intermediate product related to query processing is generated on Hadoop, A method is disclosed to streamline query processing by using products.

特開2016−91356号公報JP, 2016-91356, A 特表2016−529586号公報JP-A-2016-529586

Laura M. Haas,et al. “Optimizing Queries across Diverse Data Sources”, VLDB '97 Proceedings of the 23rd International Conference on Very Large Data Bases, pp. 276-285 (1997)Laura M. Haas, et al. “Optimizing Queries across Diverse Data Sources”, VLDB '97 Proceedings of the 23rd International Conference on Very Large Data Bases, pp. 276-285 (1997)

特許文献1に記載の方法を用いることで、複数のデータベースのそれぞれに格納されているテーブルを参照する場合のデータ通信量を削減することができる。しかしながら、問合せ文が複数のデータベースのそれぞれに格納されているテーブルを参照する場合において、これらのテーブルが同程度のサイズであるとき、テーブルの移動を行うことにより、通信量が増えてしまうという問題が発生する。   By using the method described in Patent Document 1, it is possible to reduce the amount of data communication when referring to the tables stored in each of the plurality of databases. However, when the query statement refers to the tables stored in each of a plurality of databases, if the tables have the same size, moving the tables may increase the amount of communication. Occurs.

また、特許文献2に記載の方法を用いることにより、中間生成物を再生成するための処理量及び通信量を削減することができる。しかしながら、特許文献2に記載の方法は、Hadoop上に生成された中間生成物を用いているため、任意の複数のデータベースシステムに拡張できないという問題がある。   Moreover, by using the method described in Patent Document 2, it is possible to reduce the amount of processing and the amount of communication for regenerating the intermediate product. However, the method described in Patent Document 2 has a problem that it can not be extended to any plurality of database systems because it uses the intermediate product generated on Hadoop.

そこで、本発明はこれらの点に鑑みてなされたものであり、複数のデータベースを使用する環境において、問合せ文の実行性能を向上させることができるデータベース管理装置、データベース管理方法及びデータベース管理プログラムを提供することを目的とする。   Therefore, the present invention has been made in view of these points, and provides a database management apparatus, database management method, and database management program capable of improving the execution performance of a query statement in an environment using a plurality of databases. The purpose is to

本発明の第1の態様に係るデータベース管理装置は、複数のデータベースのそれぞれに含まれている複数のテーブルのそれぞれの格納先を管理する物理モデルと、前記テーブルのビューを含む、ユーザが参照する仮想テーブルを管理する論理モデルとを記憶する記憶部と、複数の前記データベースの少なくともいずれかに対応する複数の問合せ文を取得する取得部と、前記論理モデル及び前記物理モデルに基づいて、取得された複数の前記問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数の前記データベースを参照する副問合せを特定する特定部と、特定された前記副問合せに対応する物理的なビューを作成する作成部と、前記ビューが作成されると、作成された前記ビューを前記ユーザが参照可能に前記論理モデル及び前記物理モデルを更新する更新部と、を備える。   A database management apparatus according to a first aspect of the present invention refers to a user including a physical model managing a storage destination of each of a plurality of tables included in each of a plurality of databases, and a view of the table. Acquired based on a storage unit that stores a logical model that manages a virtual table, an acquisition unit that acquires a plurality of query statements corresponding to at least one of the plurality of databases, and the logical model and the physical model. Among the subqueries commonly included in at least some of the plurality of query sentences, a specific unit that specifies a subquery that refers to a plurality of the databases, and a physical corresponding to the specified subquery A creation unit for creating a unique view, and when the view is created, the logical mo- Comprising an update unit for updating the Le and the physical model, the.

前記データベース管理装置は、前記複数のテーブルの利用状況に基づいて、複数の前記データベースのうち、現在格納されているデータベースとは異なるデータベースに移行するテーブルを移行対象テーブルとして特定し、特定された前記移行対象テーブルを移行先のデータベースに移行する移行制御部をさらに備え、前記更新部は、前記物理モデルが示す前記移行対象テーブルの格納先を前記移行先のデータベースに更新し、前記特定部は、前記移行制御部による前記移行対象テーブルの移行が完了し、前記物理モデルが示す前記移行対象テーブルの格納先が更新された後、取得された複数の前記問合せ文に基づいて、複数の前記データベースを参照する副問合せを特定してもよい。   The database management apparatus identifies, as a migration target table, a table to be migrated to a database different from the currently stored database among the plurality of databases based on the use status of the plurality of tables. The migration control unit is further configured to migrate the migration target table to the migration destination database, the updating unit updates the storage destination of the migration target table indicated by the physical model to the migration destination database, and the identification unit After the migration of the migration target table by the migration control unit is completed and the storage destination of the migration target table indicated by the physical model is updated, a plurality of the databases are selected based on the plurality of acquired inquiry statements. You may specify a subquery to refer to.

前記データベース管理装置は、特定された前記副問合せの処理コストと、当該副問合せを前記ビューに置き換えた場合の当該ビューの処理コストとを算出する算出部をさらに備え、前記作成部は、算出された前記副問合せの処理コストと、当該副問合せを前記ビューに置き換えた場合の当該ビューの処理コストとに基づいて、前記ビューに置き換えることによって処理コストの低下量の期待値が大きい順に当該ビューを作成してもよい。   The database management apparatus further includes a calculation unit that calculates the processing cost of the identified subquery and the processing cost of the view when the subquery is replaced with the view, and the creation unit calculates Based on the processing cost of the subquery and the processing cost of the view when the subquery is replaced with the view, the view is sorted in the descending order of the expected value of the reduction amount of the processing cost by replacing the view with the view. You may create it.

前記算出部は、前記物理的なビューを前記複数のデータベースのいずれかに作成した場合に当該ビューに対応する前記問合せ文を実行するときの、前記データベース管理装置と前記複数のデータベースとの間の通信量の予測値を算出し、前記作成部は、算出された前記予測値が相対的に少なくなる前記データベースに前記物理的なビューを作成してもよい。
前記算出部は、複数の前記問合せ文のそれぞれについて、前記副問合せに対応するビューを作成した前記データベースにおいて処理が行われる範囲を特定し、特定した範囲に対応するデータに基づいて、処理コストの予測値を算出し、当該処理コストの予測値に基づいて前記通信量の予測値を補正し、前記作成部は、補正後の前記通信量の予測値が相対的に少なくなる前記データベースに前記物理的なビューを作成してもよい。
The calculation unit, when creating the physical view in any of the plurality of databases, executes the query statement corresponding to the view between the database management device and the plurality of databases. The predicted value of the communication amount may be calculated, and the creation unit may create the physical view in the database in which the calculated predicted value is relatively small.
The calculation unit specifies, for each of a plurality of the query sentences, a range in which processing is performed in the database in which a view corresponding to the subquery is created, and based on data corresponding to the specified range, The predicted value is calculated, and the predicted value of the communication amount is corrected based on the predicted value of the processing cost, and the creation unit is configured to calculate the physical property of the database in which the predicted value of the communication amount after correction relatively decreases. You may create a static view.

前記作成部は、前記データベース管理装置の記憶部に前記物理的なビューを作成してもよい。   The creation unit may create the physical view in a storage unit of the database management apparatus.

本発明の第2の態様に係るデータベース管理方法は、コンピュータが実行する、複数のデータベースの少なくともいずれかに対応する複数の問合せ文を取得するステップと、前記複数のデータベースのそれぞれに含まれている複数のテーブルのそれぞれの格納先を管理する物理モデルと、前記テーブルのビューを含む、ユーザが参照する仮想テーブルを管理する論理モデルとに基づいて、取得された複数の前記問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数の前記データベースを参照する副問合せを特定するステップと、特定された前記副問合せに対応する物理的なビューを作成するステップと、前記ビューが作成されると、作成された前記ビューを前記ユーザが参照可能に前記論理モデルを更新するステップと、を備える。   A database management method according to a second aspect of the present invention includes steps of acquiring a plurality of query sentences corresponding to at least one of a plurality of databases, which are executed by a computer, and each of the plurality of databases. At least a portion of the plurality of acquired query statements based on a physical model that manages each storage destination of a plurality of tables, and a logical model that manages virtual tables referenced by a user, including a view of the tables Identifying a subquery that refers to a plurality of the databases among subqueries commonly included in the query statement, creating a physical view corresponding to the identified subquery, and the view Updating the logical model so that the user can refer to the created view when created , Comprising a.

本発明の第3の態様に係るデータベース管理プログラムは、コンピュータを、複数のデータベースの少なくともいずれかに対応する複数の問合せ文を取得する取得部、前記複数のデータベースのそれぞれに含まれている複数のテーブルのそれぞれの格納先を管理する物理モデルと、前記テーブルのビューを含む、ユーザが参照する仮想テーブルを管理する論理モデルとに基づいて、取得された複数の前記問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数の前記データベースを参照する副問合せを特定する特定部、特定された前記副問合せに対応する物理的なビューを作成する作成部、及び、前記ビューが作成されると、作成された前記ビューを前記ユーザが参照可能に前記論理モデルを更新する更新部、として機能させる。   A database management program according to a third aspect of the present invention includes a computer, an acquisition unit for acquiring a plurality of query sentences corresponding to at least one of a plurality of databases, and a plurality of the plurality of databases included in each of the plurality of databases. A query of at least a part of the plurality of acquired query statements based on a physical model that manages each storage destination of the table and a logical model that manages a virtual table referenced by the user, including a view of the table Among the subqueries commonly included in the statement, an identifying unit that identifies subqueries that refer to a plurality of the databases, a creating unit that creates a physical view corresponding to the identified subqueries, and the view An update unit that updates the logical model so that the user can refer to the created view when created Make.

本発明によれば、複数のデータベースを使用する環境において、問合せ文の実行性能を向上させることができるという効果を奏する。   According to the present invention, it is possible to improve the execution performance of a query statement in an environment using a plurality of databases.

第1実施形態に係る仮想データベースシステムの構成を示す図である。It is a figure showing composition of a virtual database system concerning a 1st embodiment. 第1実施形態に係るデータベース管理装置の構成を示す図である。It is a figure which shows the structure of the database management apparatus which concerns on 1st Embodiment. 第1実施形態に係る問合せ文の一例を示す図である。It is a figure which shows an example of the inquiry sentence which concerns on 1st Embodiment. 図3に示す問合せ文に対応する実行計画を示す図である。It is a figure which shows the execution plan corresponding to the query sentence shown in FIG. 第1実施形態に係るマテリアライズドビューの作成に係る処理の流れを示すフローチャートである。It is a flow chart which shows a flow of processing concerning creation of a materialized view concerning a 1st embodiment. 第2実施形態に係るデータベース管理装置の構成を示す図である。It is a figure which shows the structure of the database management apparatus which concerns on 2nd Embodiment.

<第1実施形態>
[仮想データベースシステムSの概要]
図1は、第1実施形態に係る仮想データベースシステムSの構成を示す図である。仮想データベースシステムSは、データベース11を物理的に格納する複数の記憶装置1と、データベース管理装置2と、ユーザ端末3とを備え、複数のデータベース11を仮想的に統合するシステムである。なお、図1において、ユーザ端末3は1台のみ示されているが、複数のユーザ端末3がデータベース管理装置2に接続されているものとする。
First Embodiment
[Overview of Virtual Database System S]
FIG. 1 is a diagram showing the configuration of a virtual database system S according to the first embodiment. The virtual database system S is a system that includes a plurality of storage devices 1 for physically storing databases 11, a database management device 2, and a user terminal 3, and virtually integrates the plurality of databases 11. Although only one user terminal 3 is shown in FIG. 1, it is assumed that a plurality of user terminals 3 are connected to the database management device 2.

データベース管理装置2は、データベース11に格納されているテーブルを示す情報であるスキーマ情報として、物理モデルと、論理モデルとを記憶している。物理モデルは、テーブルの物理的な格納場所を示すモデルである。論理モデルは、ユーザ端末3が参照可能な仮想的なテーブルを管理するモデルであり、仮想的なテーブルと、物理モデルが示すテーブルとの関連付けを行う。ここで、仮想的なテーブルには、データベース管理装置2が作成したビューが含まれる。データベース管理装置2は、ユーザ端末3から論理モデルに対応する問合せ文を取得すると、物理モデルを参照し、当該問合せ文に対応する1以上のデータベース11を特定する。   The database management device 2 stores a physical model and a logical model as schema information which is information indicating a table stored in the database 11. The physical model is a model that indicates the physical storage location of the table. The logical model is a model for managing a virtual table that can be referred to by the user terminal 3, and associates the virtual table with the table indicated by the physical model. Here, the virtual table includes the view created by the database management device 2. When acquiring the query sentence corresponding to the logical model from the user terminal 3, the database management device 2 refers to the physical model and specifies one or more databases 11 corresponding to the query sentence.

データベース管理装置2は、特定したデータベース11からデータを取得して問合せ文に対応する演算を実行し、実行結果をユーザ端末3に出力する。これにより、ユーザは、データベース11の物理的な位置を意識することなく複数のデータベース11に格納されているデータを参照することができる。   The database management device 2 acquires data from the identified database 11, executes an operation corresponding to the inquiry sentence, and outputs an execution result to the user terminal 3. Thereby, the user can refer to the data stored in the plurality of databases 11 without being aware of the physical position of the database 11.

データベース管理装置2は、問合せ文に対応する複数のテーブルが同一のデータベース11に格納されている場合に、問合せ文の実行時のデータ通信量を減らすために、問合せ文に対応する処理を当該データベース11上で行わせる。また、データベース管理装置2は、問合せ文に対応する複数のテーブルが同一のデータベース11に格納されていない場合に、問合せ文に対応するテーブルをデータベース管理装置2が取得し、データベース管理装置2において問合せ文に対応する処理を行う。このため、問合せ文に対応するテーブルが同一のデータベース11に格納されていない場合には、データ通信量が増加し、問合せ文の実行性能が悪化するという問題が発生する。   When a plurality of tables corresponding to a query statement are stored in the same database 11, the database management device 2 performs processing corresponding to the query statement to reduce the amount of data communication when the query statement is executed. Let's do it on 11th. Also, in the case where the plurality of tables corresponding to the query statement are not stored in the same database 11, the database management device 2 acquires the table corresponding to the query statement, and the database management device 2 makes an inquiry Perform processing corresponding to the statement. For this reason, when the table corresponding to the query statement is not stored in the same database 11, the amount of data communication is increased, which causes a problem that the execution performance of the query statement is deteriorated.

このような問題に対して、本実施形態に係るデータベース管理装置2は、ユーザ端末3から取得した複数の問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数のデータベース11を参照する副問合せを特定する。そして、データベース管理装置2は、自身の記憶領域に、特定した副問合せに対応する物理的なビューであるマテリアライズドビューを作成する。データベース管理装置2は、作成されたマテリアライズドビューをユーザが参照可能に論理モデルを更新する。このようにすることで、データベース管理装置2は、任意の複数のデータベース11を使用する環境において、問合せ文の実行性能を向上させることができる。
続いて、データベース管理装置2の構成を説明する。
With respect to such a problem, the database management device 2 according to the present embodiment is configured to use the plurality of databases 11 among the sub-queries commonly included in at least some of the plurality of query sentences acquired from the user terminal 3. Identify the subquery that references Then, the database management device 2 creates a materialized view, which is a physical view corresponding to the identified subquery, in its own storage area. The database management device 2 updates the logical model so that the user can refer to the created materialized view. By doing this, the database management device 2 can improve the execution performance of the query statement in an environment using any plurality of databases 11.
Subsequently, the configuration of the database management device 2 will be described.

[データベース管理装置2の構成]
図2は、第1実施形態に係るデータベース管理装置2の構成を示す図である。データベース管理装置2は、コンピュータであり、LAN(Local Area Network)等を介して、複数の記憶装置1と、ユーザ端末3とに通信可能に接続されている。
[Configuration of Database Management Device 2]
FIG. 2 is a diagram showing the configuration of the database management device 2 according to the first embodiment. The database management device 2 is a computer, and is communicably connected to the plurality of storage devices 1 and the user terminal 3 via a LAN (Local Area Network) or the like.

データベース管理装置2は、図2に示すように、記憶部21と、制御部22とを備える。
記憶部21は、例えば、ROM(Read Only Memory)及びRAM(Random Access Memory)等である。記憶部21は、データベース管理装置2を機能させるための各種プログラムを記憶する。例えば、記憶部21は、データベース管理装置2の制御部22を、後述する受付部221、実行部222、取得部223、特定部224、算出部225、作成部226及び更新部227として機能させるデータベース管理プログラムを記憶する。
The database management device 2 includes a storage unit 21 and a control unit 22 as shown in FIG.
The storage unit 21 is, for example, a read only memory (ROM) or a random access memory (RAM). The storage unit 21 stores various programs for causing the database management device 2 to function. For example, the storage unit 21 causes the control unit 22 of the database management device 2 to function as a reception unit 221, an execution unit 222, an acquisition unit 223, a specification unit 224, a calculation unit 225, a creation unit 226, and an update unit 227 described later. Remember the management program.

また、記憶部21は、データベース11に格納されているテーブルを示す情報であるスキーマ情報として、物理モデルPMと論理モデルLMとを記憶する。物理モデルPMは、複数のデータベース11に格納されている複数のテーブルの格納先を管理する。具体的には、物理モデルPMは、データベース11に格納されているテーブルを識別するテーブル名と、当該テーブルが格納されているデータベース11を識別するデータベース識別情報とを関連付けて記憶する。   The storage unit 21 also stores the physical model PM and the logical model LM as schema information that is information indicating a table stored in the database 11. The physical model PM manages storage destinations of a plurality of tables stored in a plurality of databases 11. Specifically, the physical model PM associates and stores a table name for identifying a table stored in the database 11 and database identification information for identifying the database 11 in which the table is stored.

論理モデルLMは、ユーザが参照する仮想テーブルを管理する。論理モデルLMは、仮想テーブルを識別するテーブル名と、当該仮想テーブルの構成を示す情報とを関連付けて記憶する。ここで、仮想テーブルの構成を示す情報は、物理モデルPMが示すテーブル名、又は、データベース管理装置2や、ユーザ端末3のユーザによって作成されたビューである。ここで、ビューには、物理的なビューであるマテリアライズドビューだけではなく、副問合せの内容を記述した論理的なビューが含まれていてもよい。   The logical model LM manages virtual tables referenced by the user. The logical model LM associates and stores a table name for identifying a virtual table and information indicating the configuration of the virtual table. Here, the information indicating the configuration of the virtual table is a table name indicated by the physical model PM, or a view created by the user of the database management device 2 or the user terminal 3. Here, the view may include not only the physical view materialized view but also a logical view describing the contents of the subquery.

制御部22は、例えばCPU(Central Processing Unit)である。制御部22は、記憶部21に記憶されている各種プログラムを実行することにより、データベース管理装置2に係る機能を制御する。制御部22は、データベース管理プログラムを実行することにより、受付部221、実行部222、取得部223、特定部224、算出部225、作成部226及び更新部227として機能する。   The control unit 22 is, for example, a CPU (Central Processing Unit). The control unit 22 controls various functions related to the database management apparatus 2 by executing various programs stored in the storage unit 21. The control unit 22 functions as a reception unit 221, an execution unit 222, an acquisition unit 223, a specification unit 224, a calculation unit 225, a creation unit 226, and an update unit 227 by executing a database management program.

受付部221は、ユーザ端末3から複数のデータベース11の少なくともいずれかに対応する問合せ文を受け付ける。具体的には、受付部221は、ユーザ端末3から、複数の問合せ文として、SQL(Structured Query Language)で記述された命令文を受け付ける。   The receiving unit 221 receives an inquiry sentence corresponding to at least one of the plurality of databases 11 from the user terminal 3. Specifically, the reception unit 221 receives, from the user terminal 3, a command statement described in SQL (Structured Query Language) as a plurality of query statements.

実行部222は、受付部221により受け付けられた問合せ文に対応する処理を行う。まず、実行部222は、取得された問合せ文に対応する実行計画を示す実行計画情報を生成する。ここで、実行計画は木構造を有している。   The execution unit 222 performs processing corresponding to the inquiry sentence received by the reception unit 221. First, the execution unit 222 generates execution plan information indicating an execution plan corresponding to the acquired query statement. Here, the execution plan has a tree structure.

図3は、第1実施形態に係る問合せ文の一例を示す図である。図3では、(a)、(b)に示すように2つの問合せ文を示している。図4(a)、(b)は、図3(a)、(b)に示す問合せ文に対応する実行計画を示す図である。図4に示されるように、実行計画は木構造であることが確認できる。また、図4に示されるように、楕円内には、問合せ文によって実行される処理の種類が記載されている。また、処理の種類がテーブルのスキャンである場合には、処理の後にスキャン対象となるテーブル名(例えば、customerやorders)が示されている。なお、図4に示される実行計画では、テーブルから選択するカラムの指定や、テーブルから行を選択する条件といった処理の内容については記載を省略している。   FIG. 3 is a diagram showing an example of an inquiry sentence according to the first embodiment. In FIG. 3, two query sentences are shown as shown in (a) and (b). FIGS. 4A and 4B are diagrams showing an execution plan corresponding to the query statement shown in FIGS. 3A and 3B. As shown in FIG. 4, it can be confirmed that the execution plan is a tree structure. Further, as shown in FIG. 4, the type of processing executed by the query sentence is described in the ellipse. Also, when the type of process is scan of a table, the table name (for example, customer or orders) to be scanned after the process is shown. In the execution plan shown in FIG. 4, the contents of processing such as designation of a column to be selected from the table and a condition to select a row from the table are omitted.

実行部222は、実行計画に基づいて、取得された問合せ文に対応する処理を行う。例えば、実行部222は、問合せ文に対応するテーブルが同一のデータベース11に格納されている場合に、問合せ文に対応する処理を当該データベース11上で行わせる。また、実行部222は、問合せ文に対応するテーブルが同一のデータベース11に格納されていない場合に、問合せ文に対応するテーブルをデータベース11から取得し、当該テーブルを用いて問合せ文に対応する処理を行う。   The execution unit 222 performs processing corresponding to the acquired inquiry statement based on the execution plan. For example, when the table corresponding to the query statement is stored in the same database 11, the execution unit 222 causes the database 11 to perform processing corresponding to the query statement. In addition, when the table corresponding to the query statement is not stored in the same database 11, the execution unit 222 acquires the table corresponding to the query statement from the database 11, and uses the table to process the table corresponding to the query statement. I do.

また、実行部222は、問合せ文に対応するマテリアライズドビューが記憶部21に記憶されている場合に、当該マテリアライズドビューを参照してデータを取得し、当該データを用いて問合せ文に対応する処理を行う。   In addition, when the materialized view corresponding to the query statement is stored in the storage unit 21, the execution unit 222 refers to the materialized view to obtain data, and uses the data to perform processing corresponding to the query statement. Do.

実行部222は、問合せ文の実行結果をユーザ端末3に出力する。また、実行部222は、取得された問合せ文と、当該問合せ文に対応する実行計画と、当該問合せ文を受け付けた日時とを関連付けて記憶部21に記憶させる。   The execution unit 222 outputs the execution result of the inquiry sentence to the user terminal 3. In addition, the execution unit 222 associates the acquired query sentence, the execution plan corresponding to the query sentence, and the date and time when the query sentence is received, and stores the associated query sentence in the storage unit 21.

取得部223は、複数のデータベース11の少なくともいずれかに対応する複数の問合せ文を取得する。具体的には、取得部223は、記憶部21に記憶されている複数の問合せ文と、当該問合せ文に関連付けられている実行計画とを所定時間(例えば1週間)おきに取得する。ここで、取得部223は、記憶部21に記憶されている複数の問合せ文のうち、現在時刻から所定期間以内に受付部221が受け付けた問合せ文を取得してもよい。このようにすることで、データベース管理装置2は、直近の問合せ文の使用傾向に対応してマテリアライズドビューを作成することができる。   The acquisition unit 223 acquires a plurality of query sentences corresponding to at least one of the plurality of databases 11. Specifically, the acquiring unit 223 acquires a plurality of inquiry sentences stored in the storage unit 21 and an execution plan associated with the inquiry sentence at predetermined time intervals (for example, one week). Here, among the plurality of inquiry sentences stored in the storage unit 21, the acquisition unit 223 may acquire an inquiry sentence accepted by the reception unit 221 within a predetermined period from the current time. By doing this, the database management device 2 can create a materialized view according to the usage tendency of the latest query statement.

特定部224は、取得部223によって取得された複数の問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せ文を特定する。例えば、特定部224は、複数の問合せ文とともに取得された複数の実行計画の少なくとも一部の実行計画に共通に含まれ、副問合せの構造を示す共通部分木を特定し、当該共通部分木に対応する副問合せを特定する。特定部224は、記憶部21に記憶されている論理モデルLM及び物理モデルPMに基づいて、特定された副問合せ文のうち、複数のデータベース11を参照する副問合せを特定する。   The identifying unit 224 identifies a sub-query that is commonly included in at least some of the plurality of query sentences acquired by the acquiring unit 223. For example, the identifying unit 224 identifies a common subtree which is commonly included in at least a part of the execution plans of the plurality of execution plans acquired together with the plurality of query sentences and which indicates the structure of the subquery. Identify the corresponding subquery. The identifying unit 224 identifies, based on the logical model LM and the physical model PM stored in the storage unit 21, sub-queries that reference the plurality of databases 11 among the identified sub-queries.

算出部225は、特定された副問合せの処理コストと、当該副問合せをマテリアライズドビューに置き換えた場合の当該マテリアライズドビューの処理コストとを算出する。ここで、処理コストには、副問合せを実行する場合の計算コストと、通信ネットワーク等を介してデータを取得する時間を示す通信コストとが含まれる。例えば、算出部225は、特定された副問合せが参照するテーブルのレコード数に基づいて副問合せの計算コストを算出するとともに、当該副問合せの結果得られるレコード数又はデータ量に基づいて通信コストを算出する。そして、算出部225は、算出した計算コストと通信コストとに基づいて、副問合せの処理コストを算出する。   The calculating unit 225 calculates the processing cost of the identified subquery and the processing cost of the materialized view when the subquery is replaced with a materialized view. Here, the processing cost includes the calculation cost for executing the subquery and the communication cost indicating the time for acquiring data via the communication network or the like. For example, the calculating unit 225 calculates the calculation cost of the subquery based on the number of records in the table referred to by the specified subquery, and the communication cost based on the number of records or the data amount obtained as a result of the subquery. calculate. Then, the calculation unit 225 calculates the processing cost of the subquery based on the calculated calculation cost and the communication cost.

同様に、算出部225は、副問合せをマテリアライズドビューに置き換えた場合における、当該マテリアライズドビューの処理コストを算出する。ここで、マテリアライズドビューは、テーブルを連結する処理が不要になることから、副問合せを実行する場合に比べて計算コストが著しく小さくなる。また、マテリアライズドビューを記憶部21に記憶された場合には、マテリアライズドビューに対応するデータを取得するときの通信コストが著しく小さくなる。   Similarly, the calculation unit 225 calculates the processing cost of the materialized view when the subquery is replaced with the materialized view. Here, since the materialized view does not require the process of concatenating the tables, the computational cost is significantly reduced as compared with the case of executing the subquery. In addition, when the materialized view is stored in the storage unit 21, the communication cost when acquiring data corresponding to the materialized view is significantly reduced.

また、算出部225は、取得部223によって取得された複数の問合せ文に含まれている副問合せの割合に基づいて、副問合せの実行頻度を特定する。そして、算出部225は、副問合せの実行頻度と、副問合せの処理コストと、当該副問合せに対応するマテリアライズドビューの処理コストとに基づいて、副問合せをマテリアライズドビューに置き換えることによる処理コストの低下量の期待値を算出する。ここで、期待値とは、副問合せの実行頻度に基づく確率を重みとして加味した処理コストの重み付き平均である。算出部225は、実行頻度が非定常的に変動する場合は、その変動を考慮して確率を変動させ、当該確率に基づいて期待値を算出しても構わない。   In addition, the calculation unit 225 identifies the execution frequency of the subquery based on the ratio of the subquery included in the plurality of query sentences acquired by the acquisition unit 223. Then, the calculation unit 225 reduces the processing cost by replacing the subquery with the materialized view based on the execution frequency of the subquery, the processing cost of the subquery, and the processing cost of the materialized view corresponding to the subquery. Calculate the expected value of the quantity. Here, the expected value is a weighted average of the processing costs in which the probability based on the execution frequency of the subquery is added as a weight. When the execution frequency fluctuates non-stationarily, the calculation unit 225 may change the probability in consideration of the fluctuation, and may calculate the expected value based on the probability.

作成部226は、特定部224により複数のデータベース11を参照すると特定された副問合せに対応するマテリアライズドビューを作成する。具体的には、作成部226は、算出された副問合せの処理コストと、当該副問合せをマテリアライズドビューに置き換えた場合の当該ビューの処理コストと、副問合せの実行頻度とに基づいて、マテリアライズドビューに置き換えることによって処理コストの低下量の期待値が大きい順にマテリアライズドビューを作成する。   The creating unit 226 creates a materialized view corresponding to the subquery specified by the specifying unit 224 to refer to the plurality of databases 11. Specifically, the creating unit 226 determines the materialized view based on the calculated processing cost of the subquery, the processing cost of the view when the subquery is replaced with the materialized view, and the execution frequency of the subquery. Create materialized views in order of decreasing expected processing cost by replacing with.

ここで、作成部226は、データベース管理装置2の記憶部21の記憶可能容量を特定する。そして、作成部226は、特定した記憶可能容量を超えない範囲で、マテリアライズドビューを記憶部21に作成する。このようにすることで、データベース管理装置2は、マテリアライズドビューを作成中に記憶部21の記憶可能容量が足りなくなることを防止することができる。   Here, the creation unit 226 identifies the storable capacity of the storage unit 21 of the database management device 2. Then, the creation unit 226 creates the materialized view in the storage unit 21 within the range not exceeding the identified storage capacity. By doing this, the database management device 2 can prevent the storage capacity of the storage unit 21 from running short while creating the materialized view.

なお、作成部226は、マテリアライズドビューをデータベース管理装置2の記憶部21に作成したが、これに限らない。算出部225は、マテリアライズドビューを複数のデータベース11のいずれかに作成した場合に当該ビューに対応する問合せ文を実行するときのデータベース管理装置2と複数のデータベース11との間の通信量の予測値を算出してもよい。ここで、通信量は、過去の通信の統計情報、例えばスループットの平均、又は信頼区間の上限値と下限値との間の情報に基づいて算出されるようにしてもよい。そして、作成部226は、算出された予測値が相対的に小さくなるデータベース11にマテリアライズドビューを作成してもよい。   Although the creating unit 226 creates the materialized view in the storage unit 21 of the database management apparatus 2, the present invention is not limited to this. When the calculating unit 225 creates the materialized view in any of the plurality of databases 11, it estimates the amount of communication between the database management device 2 and the plurality of databases 11 when executing the query statement corresponding to the view. May be calculated. Here, the communication amount may be calculated based on statistical information of past communication, such as average throughput or information between the upper limit value and the lower limit value of the confidence interval. Then, the creation unit 226 may create a materialized view in the database 11 in which the calculated predicted value becomes relatively small.

また、算出部225は、算出する予測値について、通信量だけではなく、処理コストを加味してもよい。例えば、算出部225は、複数の問合せ文のそれぞれについて、副問合せに対応するビューを作成したデータベース11において処理が行われる範囲を特定し、特定した範囲に対応するデータに基づいて処理コストの予測値を算出し、当該処理コストの予測値に基づいて通信量の予測値を補正してもよい。そして、作成部226は、補正後の通信量の予測値が相対的に小さくなるデータベース11にマテリアライズドビューを作成してもよい。   In addition, the calculation unit 225 may add not only the communication amount but also the processing cost to the calculated predicted value. For example, the calculation unit 225 identifies, for each of a plurality of query sentences, a range in which processing is performed in the database 11 that has created a view corresponding to a subquery, and predicts processing costs based on data corresponding to the identified range. A value may be calculated, and the predicted value of the communication amount may be corrected based on the predicted value of the processing cost. Then, the creation unit 226 may create a materialized view in the database 11 in which the predicted value of the communication amount after correction is relatively small.

例えば、マテリアライズドビューを複数のデータベース11のいずれかに作成した場合、計算コストが低減する場合がある。例えば、副問合せが入れ子構造になっており、かつ、マテリアライズドビューに対応する副問合せの親に、マテリアライズドビューを配置したデータベース内のテーブルとの結合処理に関する副問合せ(親副問合せ)がある場合、計算コストが低減する。また、この場合、データが当該親副問合せにより絞り込まれることにより、データベース管理装置2とマテリアライズドビューを配置したデータベースとの間の通信量がさらに小さくなる場合がある。   For example, when the materialized view is created in any of the plurality of databases 11, the calculation cost may be reduced. For example, if the subquery has a nested structure and the parent of the subquery corresponding to the materialized view has a subquery (parent subquery) related to join processing with a table in the database in which the materialized view is arranged: Calculation cost is reduced. Further, in this case, the amount of communication between the database management device 2 and the database in which the materialized view is arranged may be further reduced by narrowing down the data by the parent subquery.

上記のケースを考慮するために、算出部225は、各問合せについて、共通部分木から根の方向に遡って、共通部分木を内包するような部分木を逐次的に参照し、マテリアライズドビューを配置したデータベース内のテーブルのみで完結する範囲を探索する。そして、算出部225は、探索の結果、共通部分木を包含し、マテリアライズドビューを配置したデータベース内のテーブルのみで完結する部分木があれば、当該部分木のレコード数又はデータ量を参照して、処理コストの予測値を算出する。具体的には、算出部225は、まず、計算コストについて、予測値を計算する上で参照するレコード数を、当該部分木の各ノードのレコード数の総和に対して、共通部分木に対応するレコード数の和に関する部分をマテリアライズドビューから取得するレコード数に置き換えたレコード数の和によって代替する。続いて、算出部225は、通信コストについて、予測値を計算する上で参照するレコード数又はデータ量を、当該部分木に対応するレコード数又はデータ量によって代替する。   In order to consider the above case, the calculation unit 225 sequentially refers to a subtree that includes the common subtree, going back from the common subtree to the direction of the root, for each query, and places the materialized view. Search for the range that is complete only with the tables in the Then, the calculation unit 225 refers to the number of records or the data amount of the subtree if there is a subtree that includes the common subtree as a result of the search and completes only with the table in the database in which the materialized view is arranged. And calculate the predicted value of the processing cost. Specifically, the calculation unit 225 first corresponds to the common subtree with respect to the total number of records of each node of the subtree with reference to the number of records to be referred to when calculating the prediction value for the calculation cost. Replace the sum of the number of records by the sum of the number of records replaced with the number of records acquired from the materialized view. Subsequently, for the communication cost, the calculating unit 225 substitutes the number of records or the amount of data to be referred to in calculating the predicted value by the number of records or the amount of data corresponding to the subtree.

ここで、作成部226は、データベース管理装置2の記憶部21の記憶可能容量を超えない範囲でマテリアライズドビューを記憶部21に作成した結果、記憶部21に作成できなかったマテリアライズドビューを、データベース11に作成するようにしてもよい。   Here, as a result of creating the materialized view in the storage unit 21 within the range that does not exceed the storage capacity of the storage unit 21 of the database management device 2, the creation unit 226 creates a materialized view that can not be created in the storage unit 21. You may make it to.

また、作成部226は、データベース管理装置2の記憶部21に自動的にマテリアライズドビューを作成することとしたが、これに限らない。作成部226は、マテリアライズドビューを作成するか否かの指示をユーザ端末3から受け付けてもよい。そして、作成部226は、マテリアライズドビューの作成を指示されたことに応じて、マテリアライズドビューを作成してもよい。また、作成部226は、データベース管理装置2の記憶部21と、データベース11とに同じマテリアライズドビューを作成してもよい。   In addition, although the creating unit 226 automatically creates the materialized view in the storage unit 21 of the database management device 2, the present invention is not limited to this. The creation unit 226 may receive an instruction from the user terminal 3 as to whether or not to create a materialized view. Then, the creation unit 226 may create a materialized view in response to an instruction to create a materialized view. Further, the creation unit 226 may create the same materialized view in the storage unit 21 of the database management device 2 and the database 11.

また、作成部226は、既に記憶部21に作成されているマテリアライズドビューの評価を行うようにしてもよい。そして、作成部226は、先入先出法、LRU(Least Recently Used)方式、又はLFU(Least Frequently Used)方式によりマテリアライズドビューを記憶部21から削除してもよい。また、作成部226は、処理コストの低下量の期待値が相対的に小さいマテリアライズドビューを記憶部21から削除してもよい。このようにすることで、データベース管理装置2は、処理コストの低下量の期待値が小さいマテリアライズドビューを記憶部21から削除し、記憶部21に、処理コストの低下量の期待値が大きいマテリアライズドビューを効率的に配置することができる。   The creating unit 226 may also evaluate the materialized view already created in the storage unit 21. Then, the creation unit 226 may delete the materialized view from the storage unit 21 according to the first-in first-out method, the Least Recently Used (LRU) method, or the Least Frequently Used (LFU) method. In addition, the creation unit 226 may delete, from the storage unit 21, a materialized view having a relatively small expected value of the reduction amount of the processing cost. By doing this, the database management device 2 deletes the materialized view having a small expected value of the reduction amount of the processing cost from the storage unit 21 and the materialized view 21 has a large expected value of the reduction amount of the processing cost. Can be arranged efficiently.

また、作成部226は、既に記憶部21に作成されているマテリアライズドビューを全て削除した後、処理コストの低下量の期待値が大きい順にマテリアライズドビューを作成してもよい。   Further, after deleting all the materialized views already created in the storage unit 21, the creation unit 226 may create the materialized views in the descending order of the expected value of the reduction amount of the processing cost.

更新部227は、マテリアライズドビューが作成されると、作成されたマテリアライズドビューを実行部222及びユーザ端末3のユーザが参照可能に物理モデルPM及び論理モデルLMを更新する。また、更新部227は、マテリアライズドビューが作成されたことを示す情報と、当該マテリアライズドビューに対応する副問合せを示す情報とを関連付けてユーザ端末3に出力してもよい。これにより、ユーザ端末3のユーザは、当該副問合せを含む問合せ文を生成するときに、当該副問合せの代わりにマテリアライズドビューを指定して、実行部222における問合せ文の処理時間を短くすることができる。   When the materialized view is created, the updating unit 227 updates the physical model PM and the logical model LM so that the user of the executing unit 222 and the user terminal 3 can refer to the created materialized view. Further, the updating unit 227 may associate the information indicating that the materialized view is created with the information indicating the subquery corresponding to the materialized view, and may output the information to the user terminal 3. Thereby, when the user of the user terminal 3 generates a query sentence including the subquery, the user may specify a materialized view instead of the subquery to shorten the processing time of the query sentence in the execution unit 222. it can.

[マテリアライズドビューの作成に係る処理の流れ]
続いて、マテリアライズドビューの作成に係る処理の流れについて説明する。図5は、第1実施形態に係るマテリアライズドビューの作成に係る処理の流れを示すフローチャートである。
[Flow of processing related to creation of materialized view]
Next, the flow of processing relating to creation of a materialized view will be described. FIG. 5 is a flowchart showing a flow of processing relating to creation of a materialized view according to the first embodiment.

まず、取得部223は、記憶部21に記憶されている、複数のデータベース11の少なくともいずれかに対応する複数の問合せ文と実行計画を取得する(S10)。
続いて、特定部224は、実行計画に基づいて、複数の問合せ文に共通に含まれる副問合せを特定する(S20)。
First, the acquisition unit 223 acquires a plurality of inquiry sentences and an execution plan corresponding to at least one of the plurality of databases 11 stored in the storage unit 21 (S10).
Subsequently, the specifying unit 224 specifies a subquery commonly included in a plurality of query sentences based on the execution plan (S20).

続いて、算出部225は、特定された副問合せの処理コスト、及び当該副問合せをマテリアライズドビューに置き換えた場合の処理コストを算出する(S30)。
続いて、作成部226は、特定された副問合せのうち、マテリアライズドビューに置き換えることによって処理コストの低下量の期待値が大きい副問合せから順にマテリアライズドビューを作成する(S40)。
Subsequently, the calculation unit 225 calculates the processing cost of the identified subquery and the processing cost when the subquery is replaced with a materialized view (S30).
Subsequently, among the identified subqueries, the creation unit 226 creates materialized views in order from the subquery in which the expected value of the reduction amount of the processing cost is large by replacing with the materialized view (S40).

続いて、作成部226は、データベース管理装置2の記憶部21に、次に作成する予定のマテリアライズドビューの記憶可能領域があるか否かを判定する(S50)。作成部226は、記憶可能領域があると判定すると、S40に処理を移し、次に作成する予定のマテリアライズドビューを作成する。また、作成部226は、記憶領域がないと判定すると、本フローチャートに係る処理を終了する。   Subsequently, the creation unit 226 determines whether or not there is a storable area of the materialized view to be created next in the storage unit 21 of the database management device 2 (S50). If the creating unit 226 determines that there is a storable area, it shifts the process to S40 and creates a materialized view to be created next. If the creating unit 226 determines that there is no storage area, the processing according to the present flowchart ends.

[第1実施形態における効果]
以上のとおり、第1実施形態に係るデータベース管理装置2は、複数のデータベース11の少なくともいずれかに対応する複数の問合せ文を取得し、当該複数の問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数のデータベース11を参照する副問合せを特定する。そして、データベース管理装置2は、特定された副問合せに対応するマテリアライズドビューを作成し、当該マテリアライズドビューをユーザ端末3のユーザが参照可能に論理モデルLMを更新する。このようにすることで、データベース管理装置2は、複数のデータベース11が同時に参照されることを抑制し、任意の複数のデータベースを使用する環境において、問合せ文の実行性能を向上させることができる。
[Effect in the first embodiment]
As described above, the database management device 2 according to the first embodiment acquires a plurality of query sentences corresponding to at least one of the plurality of databases 11, and commonly uses at least a part of the query sentences of the plurality of query sentences. Among the included subqueries, subqueries that reference a plurality of databases 11 are identified. Then, the database management device 2 creates a materialized view corresponding to the identified subquery, and updates the logical model LM so that the user of the user terminal 3 can refer to the materialized view. By doing so, the database management device 2 can suppress simultaneous reference to a plurality of databases 11, and can improve the query statement execution performance in an environment using any plurality of databases.

<第2実施形態>
[データベース11の利用状況に基づいてテーブルを移行した後にマテリアライズドビューを作成する]
続いて、第2実施形態について説明する。第2実施形態に係る仮想データベースシステムSでは、データベース11の利用状況に基づいてテーブルを移行した後にマテリアライズドビューを作成する点で第1実施形態と異なる。以下に、第2実施形態に係る仮想データベースシステムSについて説明する。なお、第1実施形態と同じ部分については適宜説明を省略する。
Second Embodiment
Create a materialized view after migrating tables based on usage of database 11
Subsequently, a second embodiment will be described. The virtual database system S according to the second embodiment is different from the first embodiment in that materialized views are created after migrating a table based on the usage status of the database 11. The virtual database system S according to the second embodiment will be described below. Description of the same parts as those of the first embodiment will be omitted as appropriate.

図6は、第2実施形態に係るデータベース管理装置2の構成を示す図である。図6に示されるように、データベース管理装置2の制御部22は、移行制御部228をさらに備える。   FIG. 6 is a diagram showing the configuration of the database management device 2 according to the second embodiment. As shown in FIG. 6, the control unit 22 of the database management device 2 further includes a transition control unit 228.

移行制御部228は、所定時間おきに記憶部21に記憶されている複数の問合せ文と、当該問合せ文に対応する実行計画を取得する。そして、移行制御部228は、取得した複数の問合せ文及び実行計画に基づいて、複数のテーブルの利用状況を特定する。   The transition control unit 228 acquires a plurality of inquiry sentences stored in the storage unit 21 at predetermined time intervals and an execution plan corresponding to the inquiry sentence. Then, the migration control unit 228 identifies the usage status of the plurality of tables based on the acquired plurality of inquiry sentences and the execution plan.

移行制御部228は、特定した複数のテーブルの利用状況に基づいて、複数のデータベース11のうち、現在格納されているデータベース11とは異なるデータベース11に移行するテーブルを移行対象テーブルとして特定する。   The migration control unit 228 identifies a table to be migrated to the database 11 different from the currently stored database 11 among the plurality of databases 11 as a migration target table based on the usage status of the plurality of identified tables.

移行制御部228は、特定された移行対象テーブルを移行先のデータベース11に移行する。具体的には、移行制御部228は、特定された移行対象テーブルを移行先のデータベース11に複製し、移行対象テーブルの複製が完了すると、移行元のデータベース11から、移行対象テーブルを消去する。   The migration control unit 228 migrates the identified migration target table to the migration destination database 11. Specifically, the migration control unit 228 copies the identified migration target table to the migration destination database 11, and erases the migration target table from the migration source database 11 when replication of the migration target table is completed.

更新部227は、移行制御部228による移行対象テーブルの移行が完了すると、データベース管理装置2の物理モデルが示す移行対象テーブルの格納先を移行先のデータベースに更新する。   When the migration of the migration target table by the migration control unit 228 is completed, the updating unit 227 updates the storage destination of the migration target table indicated by the physical model of the database management device 2 to the migration destination database.

このようにすることで、データベース管理装置2は、テーブルの利用状況に基づいて、テーブルを適切なデータベースに配置することができる。これにより、データベース管理装置2が、問合せ文をデータベース11に実行させる機会が増加するので、問合せ文の実行時のデータ通信量を削減し、問合せ文の実行性能を向上させることができる。   By doing this, the database management device 2 can arrange the table in an appropriate database based on the usage of the table. As a result, the database management device 2 increases the chances of causing the database 11 to execute the query statement, so the amount of data communication at the time of execution of the query statement can be reduced and the query statement execution performance can be improved.

取得部223は、移行制御部228による移行対象テーブルの移行が完了し、更新部227により物理モデルが示す移行対象テーブルの格納先が更新された後、記憶部21から、複数の問合せ文及び実行計画を取得する。   After the migration control unit 228 completes migration of the migration target table and the updating unit 227 updates the storage destination of the migration target table indicated by the physical model, the acquiring unit 223 executes a plurality of inquiry statements and execution from the storage unit 21. Get a plan.

特定部224は、更新部227により物理モデルが示す移行対象テーブルの格納先が更新された後に取得された複数の問合せ文に基づいて、複数のデータベース11を参照する副問合せを特定する。
そして、作成部226は、特定部224により複数のデータベース11を参照すると特定された副問合せに対応するマテリアライズドビューを作成する。
The identifying unit 224 identifies sub-queries that reference the plurality of databases 11 based on the plurality of query sentences acquired after the storage destination of the migration target table indicated by the physical model is updated by the updating unit 227.
Then, the creating unit 226 creates a materialized view corresponding to the subquery identified by the identifying unit 224 referring to the plurality of databases 11.

[第2実施形態における効果]
以上説明したように、第2実施形態に係るデータベース管理装置2は、複数のテーブルの利用状況に基づいて、複数のデータベース11のうち、現在格納されているデータベース11とは異なるデータベース11に移行するテーブルを移行対象テーブルとして特定し、特定された移行対象テーブルを移行先のデータベース11に移行する。そして、データベース管理装置2は、移行対象テーブルの移行が完了し、物理モデルが示す移行対象テーブルの格納先が更新された後、取得された複数の問合せ文に基づいて、複数のデータベース11を参照する副問合せを特定し、当該副問合せに対応するマテリアライズドビューを作成する。
[Effect in Second Embodiment]
As described above, the database management device 2 according to the second embodiment migrates to the database 11 different from the database 11 currently stored among the plurality of databases 11 based on the usage status of the plurality of tables. The table is identified as a migration target table, and the identified migration target table is migrated to the migration destination database 11. Then, after the migration of the migration target table is completed and the storage destination of the migration target table indicated by the physical model is updated, the database management device 2 refers to the plurality of databases 11 based on the plurality of acquired query statements. Identify the subquery to be created, and create a materialized view corresponding to the subquery.

このようにすることで、データベース管理装置2は、移行対象テーブルの移行後に異なるデータベース11に格納されている複数のテーブルを参照する副問合せ文を含む問合せ文の実行性能を向上させることができる。   By doing this, the database management device 2 can improve the execution performance of the query statement including the sub query statement referring to a plurality of tables stored in different databases 11 after the migration of the migration target table.

以上、本発明を実施形態を用いて説明したが、本発明の技術的範囲は上記実施形態に記載の範囲には限定されない。上記実施形態に、多様な変更又は改良を加えることが可能であることが当業者に明らかである。例えば、上述の複数の実施形態を組み合わせてもよい。また、特に、装置の分散・統合の具体的な実施形態は以上に図示するものに限られず、その全部又は一部について、種々の付加等に応じて、又は、機能負荷に応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。   As mentioned above, although this invention was demonstrated using embodiment, the technical scope of this invention is not limited to the range as described in the said embodiment. It is apparent to those skilled in the art that various changes or modifications can be added to the above embodiment. For example, the above embodiments may be combined. Further, in particular, the specific embodiment of the distribution and integration of the devices is not limited to the one illustrated above, but all or part of the embodiments according to various additions or the like, or according to the functional load. It can be configured to be distributed or integrated functionally or physically in units.

例えば、上述の実施形態では、データベース管理装置2が、問合せ文の実行管理及び移行制御を行うこととしたが、これに限らない。例えば、データベース管理装置2とは異なる1以上のサーバが、問合せ文の実行管理及びテーブルの移行制御を行ってもよい。   For example, in the above-described embodiment, although the database management device 2 performs execution management and transition control of a query statement, the present invention is not limited to this. For example, one or more servers different from the database management device 2 may perform execution management of the query statement and transition control of the table.

1・・・記憶装置、11・・・データベース、2・・・データベース管理装置、21・・・記憶部、22・・・制御部、221・・・受付部、222・・・実行部、223・・・取得部、224・・・特定部、225・・・算出部、226・・・作成部、227・・・更新部、228・・・移行制御部、3・・・ユーザ端末、S・・・仮想データベースシステム DESCRIPTION OF SYMBOLS 1 ... Storage device, 11 ... Database, 2 ... Database management device, 21 ... Storage part, 22 ... Control part, 221 ... Reception part, 222 ... Execution part, 223 ... acquisition unit, 224 ... identification unit, 225 ... calculation unit, 226 ... creation unit, 227 ... update unit, 228 ... transition control unit, 3 ... user terminal, S ... Virtual database system

Claims (8)

複数のデータベースのそれぞれに含まれている複数のテーブルのそれぞれの格納先を管理する物理モデルと、前記テーブルのビューを含む、ユーザが参照する仮想テーブルを管理する論理モデルとを記憶する記憶部と、
複数の前記データベースの少なくともいずれかに対応する複数の問合せ文を取得する取得部と、
前記論理モデル及び前記物理モデルに基づいて、取得された複数の前記問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数の前記データベースを参照する副問合せを特定する特定部と、
特定された前記副問合せに対応する物理的なビューを作成する作成部と、
前記ビューが作成されると、作成された前記ビューを前記ユーザが参照可能に前記論理モデル及び前記物理モデルを更新する更新部と、
を備えるデータベース管理装置。
A storage unit that stores a physical model that manages the storage destination of each of a plurality of tables included in each of a plurality of databases, and a logical model that manages a virtual table referenced by a user, including a view of the table; ,
An acquisition unit for acquiring a plurality of query sentences corresponding to at least one of the plurality of databases;
An identifying unit that identifies, based on the logical model and the physical model, among the subqueries commonly included in at least a part of the plurality of acquired query sentences, a subquery that refers to the plurality of databases; When,
A creation unit that creates a physical view corresponding to the identified subquery;
An updating unit that updates the logical model and the physical model so that the user can refer to the created view when the view is created;
Database management device comprising:
前記複数のテーブルの利用状況に基づいて、複数の前記データベースのうち、現在格納されているデータベースとは異なるデータベースに移行するテーブルを移行対象テーブルとして特定し、特定された前記移行対象テーブルを移行先のデータベースに移行する移行制御部をさらに備え、
前記更新部は、前記物理モデルが示す前記移行対象テーブルの格納先を前記移行先のデータベースに更新し、
前記特定部は、前記移行制御部による前記移行対象テーブルの移行が完了し、前記物理モデルが示す前記移行対象テーブルの格納先が更新された後、取得された複数の前記問合せ文に基づいて、複数の前記データベースを参照する副問合せを特定する、
請求項1に記載のデータベース管理装置。
Among the plurality of databases, a table to be migrated to a database different from the currently stored database is identified as a migration target table based on the usage status of the plurality of tables, and the identified migration target table is a migration destination And a migration control unit for migrating to a database of
The updating unit updates the storage destination of the migration target table indicated by the physical model to the database of the migration destination,
The identification unit completes the migration of the migration target table by the migration control unit, and updates the storage destination of the migration target table indicated by the physical model, based on the plurality of acquired inquiry statements. Identify subqueries that reference multiple said databases,
The database management device according to claim 1.
特定された前記副問合せの処理コストと、当該副問合せを前記ビューに置き換えた場合の当該ビューの処理コストとを算出する算出部をさらに備え、
前記作成部は、算出された前記副問合せの処理コストと、当該副問合せを前記ビューに置き換えた場合の当該ビューの処理コストとに基づいて、前記ビューに置き換えることによって処理コストの低下量の期待値が大きい順に当該ビューを作成する、
請求項1又は2に記載のデータベース管理装置。
The system further includes a calculation unit that calculates the processing cost of the identified subquery and the processing cost of the view when the subquery is replaced with the view,
The creation unit is expected to reduce the processing cost by replacing the view with the view based on the calculated process cost of the subquery and the process cost of the view when the subquery is replaced with the view. Create the view in descending order of the value,
The database management device according to claim 1.
前記算出部は、前記物理的なビューを前記複数のデータベースのいずれかに作成した場合に当該ビューに対応する前記問合せ文を実行するときの、前記データベース管理装置と前記複数のデータベースとの間の通信量の予測値を算出し、
前記作成部は、算出された前記予測値が相対的に少なくなる前記データベースに前記物理的なビューを作成する、
請求項3に記載のデータベース管理装置。
The calculation unit, when creating the physical view in any of the plurality of databases, executes the query statement corresponding to the view between the database management device and the plurality of databases. Calculate the forecast value of traffic volume,
The creation unit creates the physical view in the database in which the calculated predicted value relatively decreases.
The database management device according to claim 3.
前記算出部は、複数の前記問合せ文のそれぞれについて、前記副問合せに対応するビューを作成した前記データベースにおいて処理が行われる範囲を特定し、特定した範囲に対応するデータに基づいて、処理コストの予測値を算出し、当該処理コストの予測値に基づいて前記通信量の予測値を補正し、
前記作成部は、補正後の前記通信量の予測値が相対的に少なくなる前記データベースに前記物理的なビューを作成する、
請求項4に記載のデータベース管理装置。
The calculation unit specifies, for each of a plurality of the query sentences, a range in which processing is performed in the database in which a view corresponding to the subquery is created, and based on data corresponding to the specified range, Calculating a predicted value, and correcting the predicted value of the communication amount based on the predicted value of the processing cost;
The creation unit creates the physical view in the database in which the predicted value of the communication amount after correction relatively decreases.
The database management device according to claim 4.
前記作成部は、前記データベース管理装置の記憶部に前記物理的なビューを作成する、
請求項1から5のいずれか1項に記載のデータベース管理装置。
The creation unit creates the physical view in a storage unit of the database management device.
The database management device according to any one of claims 1 to 5.
コンピュータが実行する、
複数のデータベースの少なくともいずれかに対応する複数の問合せ文を取得するステップと、
前記複数のデータベースのそれぞれに含まれている複数のテーブルのそれぞれの格納先を管理する物理モデルと、前記テーブルのビューを含む、ユーザが参照する仮想テーブルを管理する論理モデルとに基づいて、取得された複数の前記問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数の前記データベースを参照する副問合せを特定するステップと、
特定された前記副問合せに対応する物理的なビューを作成するステップと、
前記ビューが作成されると、作成された前記ビューを前記ユーザが参照可能に前記論理モデルを更新するステップと、
を備えるデータベース管理方法。
Computer runs,
Obtaining a plurality of query statements corresponding to at least one of a plurality of databases;
Acquisition based on the physical model that manages the storage destination of each of the plurality of tables included in each of the plurality of databases, and the logical model that manages the virtual tables referenced by the user, including the view of the tables Identifying a subquery that refers to a plurality of the databases among subqueries commonly included in at least a part of the plurality of the query statements.
Creating a physical view corresponding to the identified subquery;
Updating the logical model so that the user can refer to the created view when the view is created;
Database management method comprising:
コンピュータを、
複数のデータベースの少なくともいずれかに対応する複数の問合せ文を取得する取得部、
前記複数のデータベースのそれぞれに含まれている複数のテーブルのそれぞれの格納先を管理する物理モデルと、前記テーブルのビューを含む、ユーザが参照する仮想テーブルを管理する論理モデルとに基づいて、取得された複数の前記問合せ文の少なくとも一部の問合せ文に共通に含まれる副問合せのうち、複数の前記データベースを参照する副問合せを特定する特定部、
特定された前記副問合せに対応する物理的なビューを作成する作成部、及び、
前記ビューが作成されると、作成された前記ビューを前記ユーザが参照可能に前記論理モデルを更新する更新部、
として機能させるデータベース管理プログラム。
Computer,
An acquisition unit that acquires a plurality of query statements corresponding to at least one of a plurality of databases;
Acquisition based on the physical model that manages the storage destination of each of the plurality of tables included in each of the plurality of databases, and the logical model that manages the virtual tables referenced by the user, including the view of the tables An identifying unit that identifies a subquery that refers to a plurality of the databases among subqueries commonly included in at least a part of the plurality of the query statements;
A creation unit that creates a physical view corresponding to the identified subquery;
An updating unit that updates the logical model so that the user can refer to the created view when the view is created;
Database management program to act as.
JP2017238546A 2017-12-13 2017-12-13 Database management device, database management method and database management program Active JP6898215B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017238546A JP6898215B2 (en) 2017-12-13 2017-12-13 Database management device, database management method and database management program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017238546A JP6898215B2 (en) 2017-12-13 2017-12-13 Database management device, database management method and database management program

Publications (2)

Publication Number Publication Date
JP2019106039A true JP2019106039A (en) 2019-06-27
JP6898215B2 JP6898215B2 (en) 2021-07-07

Family

ID=67061303

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017238546A Active JP6898215B2 (en) 2017-12-13 2017-12-13 Database management device, database management method and database management program

Country Status (1)

Country Link
JP (1) JP6898215B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020013448A (en) * 2018-07-20 2020-01-23 Kddi株式会社 Inquiry sentence output apparatus and inquiry sentence output method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0293836A (en) * 1988-09-30 1990-04-04 Toshiba Corp Distributed data base controller
JP2006343798A (en) * 2005-06-07 2006-12-21 Hitachi Ltd Method, device and program for generating materialized view table
US20070174292A1 (en) * 2006-01-26 2007-07-26 Wen-Syan Li Autonomic recommendation and placement of materialized query tables for load distribution
JP2016091356A (en) * 2014-11-06 2016-05-23 Kddi株式会社 Virtual database system management device, management method and management program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0293836A (en) * 1988-09-30 1990-04-04 Toshiba Corp Distributed data base controller
JP2006343798A (en) * 2005-06-07 2006-12-21 Hitachi Ltd Method, device and program for generating materialized view table
US20070174292A1 (en) * 2006-01-26 2007-07-26 Wen-Syan Li Autonomic recommendation and placement of materialized query tables for load distribution
JP2016091356A (en) * 2014-11-06 2016-05-23 Kddi株式会社 Virtual database system management device, management method and management program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
大川昌弘、外2名: "分散データベース環境における複製データの仮想化によるSQL処理の最適化手法", 電子情報通信学会第18回データ工学ワークショップ論文集, JPN6020039183, 1 June 2007 (2007-06-01), pages 1 - 8, ISSN: 0004367141 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020013448A (en) * 2018-07-20 2020-01-23 Kddi株式会社 Inquiry sentence output apparatus and inquiry sentence output method

Also Published As

Publication number Publication date
JP6898215B2 (en) 2021-07-07

Similar Documents

Publication Publication Date Title
US11347761B1 (en) System and methods for distributed database query engines
US11341139B2 (en) Incremental and collocated redistribution for expansion of online shared nothing database
US10102268B1 (en) Efficient index for low latency search of large graphs
CN105630864B (en) Forced ordering of a dictionary storing row identifier values
US9934276B2 (en) Systems and methods for fault tolerant, adaptive execution of arbitrary queries at low latency
US8620903B2 (en) Database distribution system and methods for scale-out applications
US8601007B2 (en) Net change notification based cached views with linked attributes
US11475006B2 (en) Query and change propagation scheduling for heterogeneous database systems
KR20150039118A (en) Background format optimization for enhanced sql-like queries in hadoop
CN104123374A (en) Method and device for aggregate query in distributed databases
US20160253402A1 (en) Adaptive data repartitioning and adaptive data replication
US20200081903A1 (en) Splitting transaction and analysis queries
US11544217B2 (en) Utilizing machine learning to determine data storage pruning parameters
CN109582678A (en) The R tree optimiged index method of more size distribution formula Read-Write Locks based on leaf node
JP6376947B2 (en) Virtual database system management apparatus, management method, and management program
JP6898215B2 (en) Database management device, database management method and database management program
KR100994724B1 (en) Method of processing top-K skyline queries having with higher probabilities in uncertain database
Azez et al. JOUM: an indexing methodology for improving join in hive star schema
EP3951609A1 (en) Query optimization method and apparatus
JP6850720B2 (en) Query statement execution device, query statement execution method, and query statement execution program
US11734308B2 (en) Autonomous caching for views
JP2019066939A (en) Transfer management device and transfer management method
JP2017016208A (en) Virtual database system management apparatus, management method, and management program
Kassela et al. Towards a Multi-engine Query Optimizer for Complex SQL Queries on Big Data
CN112732704B (en) Data processing method, device and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20191206

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200918

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20201020

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20201214

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210518

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210610

R150 Certificate of patent or registration of utility model

Ref document number: 6898215

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150