JP5186270B2 - Database cache system - Google Patents

Database cache system Download PDF

Info

Publication number
JP5186270B2
JP5186270B2 JP2008112945A JP2008112945A JP5186270B2 JP 5186270 B2 JP5186270 B2 JP 5186270B2 JP 2008112945 A JP2008112945 A JP 2008112945A JP 2008112945 A JP2008112945 A JP 2008112945A JP 5186270 B2 JP5186270 B2 JP 5186270B2
Authority
JP
Japan
Prior art keywords
data
identification information
record
database
map
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2008112945A
Other languages
Japanese (ja)
Other versions
JP2009265840A (en
Inventor
俊夫 菅沼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
International Business Machines Corp
Original Assignee
International Business Machines 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 International Business Machines Corp filed Critical International Business Machines Corp
Priority to JP2008112945A priority Critical patent/JP5186270B2/en
Publication of JP2009265840A publication Critical patent/JP2009265840A/en
Application granted granted Critical
Publication of JP5186270B2 publication Critical patent/JP5186270B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、データベースのキャッシュシステムに関し、特に、インサート・オンリー方式のデータベースに適用できるキャッシュシステムに関する。   The present invention relates to a database cache system, and more particularly to a cache system applicable to an insert-only database.

データベースへのアクセス方式において、インサート・オンリー(insert only)と呼ばれる方式がある。この方式は、データベース・テーブルへの更新操作を、既存レコードに対して更新(update)や削除(delete)を実際に行うのではなく、常に、新規レコードの挿入(insert)によって行うものである。この方式では、データベース・テーブルの各レコードに、データの識別情報であるキー識別子(key identifier)と共に、CRUD値(CRUD value)と呼ばれる操作内容を示す情報と、操作が行われた時刻を示す情報(タイムスタンプ)とが格納される。そして、変更操作の度に新たなレコードが挿入されるため、同一のキー識別子を持ちタイムスタンプの値(以下、タイムスタンプ情報と呼ぶ)が異なる複数のレコードが変更履歴の数だけ存在することとなる。ここで、CRUD値の「CRUD」は、「作成(CReate)」、「更新(Update)」、「削除(Delete)」の頭文字である。   As a database access method, there is a method called insert only. In this method, an update operation to a database table is not performed by actually updating (delete) or deleting (delete) an existing record, but is always performed by inserting a new record. In this method, each record of the database table includes, together with a key identifier that is data identification information, information indicating an operation content called a CRUD value, and information indicating a time when the operation is performed. (Time stamp) is stored. Since a new record is inserted every time a change operation is performed, a plurality of records having the same key identifier and different time stamp values (hereinafter referred to as time stamp information) exist as many as the number of change histories. Become. Here, the CRUD value “CRUD” is an acronym for “Create”, “Update”, and “Delete”.

このインサート・オンリー方式は、過去の変更履歴を全て保存するという監査要求事項(auditing requirement)を満たす必要以外にも、ロック・コンテンション(lock contention)の確率を減らすという設計上の要求から採用されることも多い。例えば、金融に関わるアプリケーションを例に考えると、オンラインによる処理は、一般に、現在の口座残高その他の情報を表示したり振替処理をしたりするなど、最新のデータを使って処理が行われる。これに対して、バッチ処理では、過去のある時点における残高に対して利率計算を行ったり、月次報告書を作成したりする処理が行われる。すなわち、オンライン処理とバッチ処理における起点となるタイムスタンプ情報が各々異なるため、これらの処理を同時に実行し、同一のキー識別子を持つデータにアクセスする場合でも、別々のレコードにアクセスすることになる。そのため、ロック・コンテンションが起きにくくなる。   This insert-only method was adopted because of the design requirement to reduce the probability of lock contention, in addition to the need to satisfy the auditing requirement of saving all past change history. There are many cases. For example, taking an application related to finance as an example, online processing is generally performed using the latest data, such as displaying the current account balance and other information, and performing transfer processing. On the other hand, in batch processing, interest rate calculation is performed on the balance at a certain point in the past, and a monthly report is created. That is, since the time stamp information which is the starting point in the online processing and the batch processing is different, even when these processings are executed simultaneously and data having the same key identifier is accessed, different records are accessed. As a result, lock contention is less likely to occur.

ところで、データベースに対するアクセス等の処理を高速化するための一般的な手段として、キャッシュメモリを用いる方法がある(例えば、特許文献1参照)。すなわち、データベースからフェッチしたデータをサーバにおいてキャッシュしておく。そして、繰り返し発行されるクエリに対しては、パラメータに基づきハッシュ・テーブルを引くなどして、対象とするデータがキャッシュ内で利用可能かどうかチェックする。   By the way, as a general means for speeding up processing such as access to a database, there is a method using a cache memory (for example, see Patent Document 1). That is, the data fetched from the database is cached in the server. For queries that are repeatedly issued, it is checked whether the target data can be used in the cache by, for example, drawing a hash table based on the parameters.

特表2006−511876号公報JP 2006-511876 A

インサート・オンリー方式では、次のような問題がある。
第1に、データベースへのアクセスにおいて、常にタイムスタンプ情報を指定したり、CRUD値をチェックしたりしなければならない。そのため、副照会を使うなどの操作が必要となり、クエリ処理が複雑で重くなる。
第2に、データの一部分のみを変更する場合においても、データベース・テーブルにおける対象となるカラム(column)だけを選択的にフェッチして書き出すことはできない。そのため、一旦は全てのカラム内容をフェッチする必要がある。
さらに、単にデータベース中に今あるデータの中から最新のものを1レコードフェッチしたいという場合でも、タイムスタンプ情報を指定する必要があるため、呼び出し側で現在のタイムスタンプ情報(currentTimeStamp)を生成して渡してやらなければならない。
The insert-only method has the following problems.
First, in accessing the database, time stamp information must always be specified and the CRUD value must be checked. For this reason, an operation such as using a subquery is required, and the query processing becomes complicated and heavy.
Second, even when only a part of the data is changed, it is not possible to selectively fetch and write only the target column in the database table. Therefore, it is necessary to fetch all column contents once.
Furthermore, even if you want to fetch one record of the latest data from the database, you need to specify the time stamp information, so the caller generates the current time stamp information (currentTimeStamp) I have to give it.

アプリケーションの内容によっては、これらのオーバーヘッドがシステム全体の性能低下を引き起こす原因となる。特に、バッチ処理などのようにビジネスロジックが繰り返し実行される場合には、このオーバーヘッドは無視できないものとなる。また、更新がほとんど行われないようなテーブルでも、トランザクションの度にコストのかかるデータベースアクセスを繰り返すのは、アプリケーションの性能面で問題となる。   Depending on the contents of the application, these overheads can cause a decrease in the performance of the entire system. In particular, when business logic is repeatedly executed, such as in batch processing, this overhead cannot be ignored. Even for tables that are rarely updated, it is problematic in terms of application performance to repeat expensive database access for each transaction.

このような問題に対し、通常のデータベースアクセスであれば、キャッシュメモリを用いて高速化を図ることが考えられる。上記のように、インサート・オンリー方式のアプリケーションでは、キー識別子とタイムスタンプ情報の組み合わせでレコードが特定されるので、この組み合わせでクエリがかけられ、またこの組み合わせを検索キーとしてハッシュ・テーブルにデータがキャッシュされることとなる。そして、タイムスタンプ情報はクエリ作成のための読み出しごとに毎回異なるデータが渡される。そのため、単にハッシュ・テーブルに基づいて行われる従来の検索方法ではキャッシュはヒットせず、冗長な読み出しに対して有効な手段とならなかった。例えば、あるキー識別子の最新のレコードを読み出そうとする場合、そのキー識別子を持つデータがキャッシュされている場合でも、そのキャッシュデータがそのキー識別子を持つレコードの中で最新のレコードか否かを判断することはできない。   For such a problem, it is conceivable to increase the speed by using a cache memory for normal database access. As described above, in an insert-only application, a record is specified by a combination of a key identifier and time stamp information. Therefore, a query is applied by this combination, and data is stored in the hash table using this combination as a search key. It will be cached. As the time stamp information, different data is passed each time read for query creation. For this reason, the cache is not hit in the conventional search method performed simply based on the hash table, and is not an effective means for redundant reading. For example, when trying to read the latest record with a key identifier, whether or not the cached data is the latest record among the records with the key identifier even if the data with the key identifier is cached Cannot be judged.

本発明は、これらの課題を解決し、インサート・オンリー方式のアプリケーションにおいても有効なキャッシュシステムを実現することを目的とする。   An object of the present invention is to solve these problems and to realize a cache system that is effective even in an insert-only system application.

上記の目的を達成するため、本発明は、次のようなシステムとして構成される。このシステムは、データの作成、更新、削除が行われるたびに同一の識別情報が付与されたデータのレコードを追加するデータベースにおいて、このデータベースから読み出されたデータをキャッシュする保持部と、この保持部にキャッシュされるデータを管理する管理部とを備える。保持部は、データの識別情報を登録するテーブルと、このテーブルに登録された識別情報に個別に対応付けられ、データベースにおけるこの識別情報を持つレコードを示すエントリを格納するマップとを備える。管理部は、識別情報およびレコードを指定する情報を含むクエリを受け付けて保持部を検索し、該当するデータがキャッシュされていればそのデータを読み出し、該当するデータがキャッシュされていなければ、そのデータをデータベースから取得し、保持部のマップにおけるクエリにより指定された識別情報およびレコードに対応するエントリに関連付けてこのデータをキャッシュさせる。   In order to achieve the above object, the present invention is configured as the following system. This system includes a holding unit that caches data read from the database and a holding unit that adds a data record to which the same identification information is added every time data is created, updated, or deleted. A management unit that manages data cached in the unit. The holding unit includes a table for registering identification information of data, and a map for storing an entry indicating a record having the identification information in the database, individually associated with the identification information registered in the table. The management unit accepts a query including identification information and information specifying a record, searches the holding unit, reads the data if the corresponding data is cached, and reads the data if the corresponding data is not cached. Is retrieved from the database, and this data is cached in association with the entry corresponding to the identification information and record specified by the query in the map of the holding unit.

ここで、マップは、データベースに格納されており、テーブルに登録されていない所定の識別情報を持つデータに対して初めてアクセスが行われた際に生成される。
マップのエントリには、レコードが作成された際にレコードに付与される時間情報が記録される。そして、管理部は、レコードを指定する情報としてこの時間情報が一意に定まる条件を記載したクエリを受け付け、この条件にしたがって特定される時間情報を持つエントリを、このクエリにより指定されたレコードを示すエントリとする。
より詳細には、この時間情報は、レコードが作成される原因となったデータに対する操作が行われた時刻を表すタイムスタンプである。
クエリにより指定された識別情報を持つデータがデータベースに存在しない場合、その旨を示す情報が、テーブルに登録された識別情報に対応付けられて保持部に保持される。
クエリの実行により識別情報が段階的に指定される場合、テーブルとマップの間に補助エントリが設けられ、クエリに記述された最上位の識別情報がテーブルに登録され、クエリの実行により得られる下位の識別情報がテーブルの識別情報に対応付けられて補助エントリに登録され、補助エントリに登録された最下位の識別情報にマップが対応付けられる。
データベースにおいて所定の識別情報を持つデータのレコードが追加された場合に、保持部において、テーブルに登録された識別情報および識別情報に対応付けられたマップが削除され、マップのエントリに関連付けられたデータがキャッシュされているときはキャッシュされているデータも削除される。
あるいは、データベースにおいて所定の識別情報を持つデータのレコードが追加された場合に、識別情報に対応付けられたマップに、このレコードに関連付けられたエントリが追加される。
Here, the map is stored in the database and is generated when data having predetermined identification information that is not registered in the table is accessed for the first time.
In the map entry, time information given to the record when the record is created is recorded. Then, the management unit accepts a query that describes a condition for uniquely determining this time information as information for specifying a record, and indicates an entry having time information specified according to this condition as the record specified by this query. Entry.
More specifically, this time information is a time stamp indicating the time when an operation is performed on the data that caused the record to be created.
When data having identification information specified by the query does not exist in the database, information indicating that is stored in the holding unit in association with the identification information registered in the table.
When identification information is specified step by step by executing a query, an auxiliary entry is provided between the table and the map, and the highest-level identification information described in the query is registered in the table, and the lower level obtained by executing the query The identification information is associated with the identification information in the table and registered in the auxiliary entry, and the map is associated with the lowest-level identification information registered in the auxiliary entry.
When a record of data having predetermined identification information is added in the database, the identification information registered in the table and the map associated with the identification information are deleted in the holding unit, and the data associated with the map entry When is cached, the cached data is also deleted.
Alternatively, when a data record having predetermined identification information is added in the database, an entry associated with this record is added to the map associated with the identification information.

また、本発明は、次のようなデータ構造としても実現される。このデータ構造は、データの作成、更新、削除が行われるたびに同一の識別情報が付与されたデータのレコードを追加するデータベースにおける、識別情報を登録するテーブルと、テーブルに登録された識別情報に個別に対応付けられ、データベースにおける識別情報を持つレコードを示すエントリを格納するマップとを備え、所定のクエリに基づきデータベースから取得されたデータが、マップにおけるクエリにより指定された識別情報およびレコードに対応するエントリに関連付けられてキャッシュされる。
このマップには、データベースのレコードが作成された際にレコードに付与される時間情報に基づき、エントリが時系列に並べられて格納される。
また、テーブルに登録された識別情報を持つデータがデータベースに存在しない場合、マップに代えて、データが存在しない旨を示す情報が保持される。
The present invention is also realized as the following data structure. This data structure consists of a table for registering identification information in the database to which data records to which the same identification information is assigned each time data is created, updated, or deleted, and the identification information registered in the table. And a map that stores entries indicating records with identification information in the database, and the data obtained from the database based on a given query corresponds to the identification information and records specified by the query in the map It is cached in association with the entry.
In this map, entries are arranged in time series and stored based on time information given to the records when the database records are created.
When data having identification information registered in the table does not exist in the database, information indicating that no data exists is held instead of the map.

また、本発明は、次のような方法としても実現される。この方法は、データの作成、更新、削除が行われるたびに同一の識別情報が付与されたデータのレコードを追加するデータベースのキャッシュ方法であって、識別情報およびレコードを指定する情報を含むクエリを受け付け、データの識別情報を登録するテーブルに対して、クエリにより指定された識別情報を検索するステップと、テーブルにクエリにより指定された識別情報が存在しない場合、この識別情報をテーブルに登録し、この識別情報に対応づけてデータベースにおけるこの識別情報を持つレコードを示すエントリを格納するマップを生成するステップと、テーブルにクエリにより指定された識別情報が存在する場合、この識別情報に対応付けられたマップのエントリに関連付けられたデータがキャッシュされているならばそのデータを読み出し、エントリに関連付けられたデータがキャッシュされていないならばデータベースから読み出されたデータをこのエントリに関連付けてキャッシュさせるステップとを含む。   The present invention is also realized as the following method. This method is a database caching method that adds a record of data to which the same identification information is assigned every time data is created, updated, or deleted, and includes a query including identification information and information specifying the record. Accepting and searching for the identification information specified by the query with respect to the table for registering the identification information of the data, and if the identification information specified by the query does not exist in the table, register this identification information in the table, A step of generating a map storing an entry indicating a record having the identification information in the database in association with the identification information, and when the identification information specified by the query exists in the table, the map is associated with the identification information. If the data associated with the map entry is cached, Reads data, the data associated with the entry and a step of caching in association with data read from the database if not cached in the entry.

さらに本発明は、コンピュータを制御して上記のシステムにおける各機能を実現するプログラムや、上記の方法における各ステップに対応する処理をコンピュータに実行させるプログラムとして実現することもできる。このプログラムは、磁気ディスクや光ディスク、半導体メモリ、その他の記録媒体に格納して配布したり、ネットワークを介して配信したりすることにより提供することができる。   Furthermore, the present invention can also be realized as a program that controls a computer to realize each function in the above system or a program that causes a computer to execute processing corresponding to each step in the above method. This program can be provided by being stored and distributed in a magnetic disk, an optical disk, a semiconductor memory, or other recording medium, or distributed via a network.

以上のように構成された本発明によれば、データベースにおけるインサート・オンリー方式のアプリケーションにおいても有効なキャッシュシステムを実現できる。   According to the present invention configured as described above, it is possible to realize a cache system that is effective even in an insert-only application in a database.

以下、添付図面を参照して、本発明の実施形態について詳細に説明する。
<システム構成>
図1は、本実施形態が適用されるデータベースシステムの機能構成例を示す図である。
図1に示すように、本実施形態のデータベースシステム100は、データベース110と、アクセス部120とを備え、かつキャッシュシステムを実現するためのデータ保持部130と、キャッシュ管理部140と、マップ作成部150とを備える。また別の構成例として、キャッシュシステムの各構成部130、140、150は、データベースシステムの一部とせず、データベースをアクセスするアプリケーションシステムの一部として実現しても良い。さらに、アプリケーションシステムとデータベースシステムの中間にある独立したレイヤーとして実現することもできる。これらの場合、アクセス部120は、アプリケーションシステムにおいてデータをアクセスする部分を指す。
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
<System configuration>
FIG. 1 is a diagram illustrating a functional configuration example of a database system to which the present embodiment is applied.
As shown in FIG. 1, the database system 100 according to the present embodiment includes a database 110 and an access unit 120, and also includes a data holding unit 130, a cache management unit 140, and a map creation unit for realizing a cache system. 150. As another configuration example, each component 130, 140, 150 of the cache system may be realized not as a part of the database system but as a part of an application system that accesses the database. Furthermore, it can be realized as an independent layer between the application system and the database system. In these cases, the access unit 120 indicates a part for accessing data in the application system.

図2は、データベースシステム100を構成するコンピュータのハードウェア構成例を示す図である。
図2に示すコンピュータ10は、演算手段であるCPU(Central Processing Unit)10aと、記憶手段であるメイン・メモリ10cおよび磁気ディスク装置(HDD:Hard Disk Drive)10gを備える。また、ネットワークを介して外部装置に接続するためのネットワーク・インタフェース・カード10fと、表示出力を行うためのビデオ・カード10dおよび表示装置10jと、音声出力を行うための音声機構10hとを備える。さらに、キーボードやマウス等の入力デバイス10iを備える。
FIG. 2 is a diagram illustrating a hardware configuration example of a computer constituting the database system 100.
The computer 10 shown in FIG. 2 includes a CPU (Central Processing Unit) 10a that is a calculation means, a main memory 10c that is a storage means, and a magnetic disk device (HDD: Hard Disk Drive) 10g. In addition, a network interface card 10f for connecting to an external device via a network, a video card 10d and a display device 10j for performing display output, and an audio mechanism 10h for performing audio output are provided. Furthermore, an input device 10i such as a keyboard or a mouse is provided.

図2に示すように、メイン・メモリ10cおよびビデオ・カード10dは、システム・コントローラ10bを介してCPU10aに接続されている。また、ネットワーク・インタフェース・カード10f、磁気ディスク装置10g、音声機構10hおよび入力デバイス10iは、I/Oコントローラ10eを介してシステム・コントローラ10bと接続されている。各構成要素は、システム・バスや入出力バス等の各種のバスによって接続される。例えば、CPU10aとメイン・メモリ10cの間は、システム・バスやメモリ・バスにより接続される。また、CPU10aと磁気ディスク装置10g、ネットワーク・インタフェース・カード10f、ビデオ・カード10d、音声機構10h、入力デバイス10i等との間は、PCI(Peripheral Components Interconnect)、PCI Express、シリアルATA(AT Attachment)、USB(Universal Serial Bus)、AGP(Accelerated Graphics Port)等の入出力バスにより接続される。   As shown in FIG. 2, the main memory 10c and the video card 10d are connected to the CPU 10a via the system controller 10b. The network interface card 10f, the magnetic disk device 10g, the sound mechanism 10h, and the input device 10i are connected to the system controller 10b via the I / O controller 10e. Each component is connected by various buses such as a system bus and an input / output bus. For example, the CPU 10a and the main memory 10c are connected by a system bus or a memory bus. Between the CPU 10a and the magnetic disk device 10g, the network interface card 10f, the video card 10d, the audio mechanism 10h, the input device 10i, etc., PCI (Peripheral Components Interconnect), PCI Express, serial ATA (AT Attachment) , USB (Universal Serial Bus), AGP (Accelerated Graphics Port) and other input / output buses.

なお、図2は、本実施形態が適用されるのに好適なコンピュータのハードウェア構成を例示するに過ぎず、実際の各サーバが図示の構成に限定されないことは言うまでもない。例えば、ビデオ・カード10dを設ける代わりに、ビデオメモリのみを搭載し、CPU10aにてイメージ・データを処理する構成としても良い。また、音声機構10hを独立した構成とせず、システム・コントローラ10bやI/Oコントローラ10eを構成するチップセットの機能として備えるようにしても良い。また、補助記憶装置として磁気ディスク装置10gの他に、各種の光学ディスクやフレキシブル・ディスクをメディアとするドライブを設けても良い。表示装置10jとしては、主として液晶ディスプレイが用いられるが、その他、CRTディスプレイやプラズマ・ディスプレイ等、任意の方式のディスプレイを用いて良い。   Note that FIG. 2 merely exemplifies a hardware configuration of a computer suitable for application of the present embodiment, and it is needless to say that each actual server is not limited to the illustrated configuration. For example, instead of providing the video card 10d, only the video memory may be mounted and the CPU 10a may process the image data. Further, the audio mechanism 10h may be provided as a function of a chip set that constitutes the system controller 10b and the I / O controller 10e without being an independent configuration. In addition to the magnetic disk device 10g, an auxiliary storage device may be provided with a drive using various optical disks and flexible disks as media. A liquid crystal display is mainly used as the display device 10j, but any other type of display such as a CRT display or a plasma display may be used.

図1に示したデータベースシステム100において、アクセス部120、キャッシュ管理部140、マップ作成部150の各機能は、例えば図2に示したコンピュータにおいて、メイン・メモリ10cに読み込まれたプログラムをCPU10aが実行することにより実現される。データベース110は、例えば磁気ディスク装置10gにより実現され、キャッシュシステムのデータ保持部130は、例えばメイン・メモリ10cにキャッシュ領域を設けて実現される。   In the database system 100 shown in FIG. 1, the functions of the access unit 120, the cache management unit 140, and the map creation unit 150 are executed by the CPU 10 a executing the program loaded in the main memory 10 c in the computer shown in FIG. 2, for example. It is realized by doing. The database 110 is realized by, for example, the magnetic disk device 10g, and the data holding unit 130 of the cache system is realized by providing a cache area in the main memory 10c, for example.

図1において、データベース110は、検索対象のデータを格納する。本実施形態において、データベース110に対するアクセスは、インサート・オンリー方式で行われる。この方式では、データの更新操作の度にデータベース110に新規レコードが追加作成される。そして、作成されたレコードには、データを識別するためのキー識別子と、レコードが作成される原因となった操作が行われた時刻を示すタイムスタンプ情報が記録される。したがって、データベース110には、同一のキー識別子であってもタイムスタンプ情報の異なる複数のレコードが変更履歴の数だけ存在する。すなわち、タイムスタンプ情報は、同一のキー識別子を持つレコードの識別情報として用いることができる。また、各レコードには、操作内容を表すCRUD値が記録される。なお、データの読み出しでは、データベース110の状態は変更されないので、新たなレコードが生成(インサート)されることはない。したがって、CRUD値の欄(カラム)には「作成」、「更新」、「削除」のいずれかが記録されることとなる。   In FIG. 1, a database 110 stores data to be searched. In this embodiment, access to the database 110 is performed by an insert-only method. In this method, a new record is additionally created in the database 110 every time a data update operation is performed. In the created record, a key identifier for identifying data and time stamp information indicating the time when the operation causing the creation of the record is performed are recorded. Therefore, the database 110 includes a plurality of records having different time stamp information even for the same key identifier as many as the number of change histories. That is, the time stamp information can be used as identification information for records having the same key identifier. In each record, a CRUD value representing the operation content is recorded. In reading data, since the state of the database 110 is not changed, a new record is not generated (inserted). Therefore, any one of “create”, “update”, and “delete” is recorded in the column (column) of the CRUD value.

図3は、データベース110の構成例を示す図である。
図3に示すデータベース110には、キー識別子「10032752046925」に関して、タイムスタンプ情報の異なる3つのレコードが存在している。これらの各レコードのCRUD値は、タイムスタンプ情報の古いものから順に「C」、「U」、「D」であり、「C」は作成(Create)、「U」は更新(Update)、「D」は削除(Delete)を表している。すなわち、図3の例では、キー識別子「10032752046925」のデータが、作成され、1回更新された後に削除されたことが示されている。
FIG. 3 is a diagram illustrating a configuration example of the database 110.
In the database 110 illustrated in FIG. 3, there are three records with different time stamp information for the key identifier “10032752046925”. The CRUD values of these records are “C”, “U”, and “D” in order from the oldest time stamp information, where “C” is created (Create), “U” is updated (Update), “ “D” represents deletion. That is, the example of FIG. 3 shows that the data with the key identifier “10032752046925” has been created, updated once, and then deleted.

アクセス部120は、SQL等で記述されたクエリを受け付けてデータベース110にアクセスし、レコードの作成、読み出し、更新、削除等の処理を実行する。また、アクセス部120は、データベース110へのアクセスを行う際に、キャッシュ管理部140にキャッシュの操作を指示する。   The access unit 120 receives a query described in SQL or the like, accesses the database 110, and executes processing such as record creation, reading, update, and deletion. The access unit 120 instructs the cache management unit 140 to operate the cache when accessing the database 110.

データ保持部130は、キャッシュデータを保持する。本実施形態では、キー識別子に対するハッシュ・テーブルと、キー識別子ごとの全変更履歴を表現するマップと呼ぶデータ構造とを組み合わせたデータ構造により、キャッシュデータが保持される。このデータ構造の詳細については後述する。   The data holding unit 130 holds cache data. In the present embodiment, cache data is held by a data structure that is a combination of a hash table for key identifiers and a data structure called a map that represents the entire change history for each key identifier. Details of this data structure will be described later.

キャッシュ管理部140は、データ保持部130に保持されるキャッシュデータを管理する。そして、アクセス部120からの指示に応じて、データのキャッシュに関する操作を行う。具体的には、アクセス部120による読み出し要求のクエリに該当するレコードを検索し、検索結果に応じて応答を返す。該当のレコードがキャッシュされていない場合は、読み出されたレコードをキャッシュする。また、クエリに該当するキー識別子がデータ保持部130のハッシュ・テーブルに存在しない場合は、ハッシュ・テーブルにキー識別子を登録し、そのキー識別子に関するマップをマップ作成部150に作成させる。   The cache management unit 140 manages the cache data held in the data holding unit 130. Then, in response to an instruction from the access unit 120, an operation related to data caching is performed. Specifically, the record corresponding to the query of the read request by the access unit 120 is searched, and a response is returned according to the search result. If the corresponding record is not cached, the read record is cached. If the key identifier corresponding to the query does not exist in the hash table of the data holding unit 130, the key identifier is registered in the hash table and the map creating unit 150 creates a map related to the key identifier.

マップ作成部150は、キャッシュ管理部140の制御により、指示されたキー識別子のレコードのマップを作成する。マップは、キー識別子ごとにレコードの変更履歴を時系列に記録したものである。このマップを含むキャッシュのデータ構造について、以下に説明する。   The map creation unit 150 creates a map of the record with the specified key identifier under the control of the cache management unit 140. The map is a record of record change history for each key identifier in time series. The data structure of the cache including this map will be described below.

<キャッシュのデータ構造>
図4は、本実施形態におけるキャッシュのデータ構造の例を示す図である。図5は、図4におけるマップエントリのデータ構造の例を示す図である。
図4に示すように、本実施形態のキャッシュはハッシュ・テーブル410とマップ420とを組み合わせたデータ構造を持つ。図4において、ハッシュ・テーブル410には、少なくとも1回以上読み出しが行われたキー識別子とそのキー識別子に対応付けられたマップ420が登録される。図4のハッシュ・テーブル410において、灰色で示された箇所を、キー識別子が登録された箇所とする。
<Cache data structure>
FIG. 4 is a diagram showing an example of the data structure of the cache in this embodiment. FIG. 5 is a diagram showing an example of the data structure of the map entry in FIG.
As shown in FIG. 4, the cache of this embodiment has a data structure in which a hash table 410 and a map 420 are combined. In FIG. 4, a key identifier that has been read at least once and a map 420 associated with the key identifier are registered in the hash table 410. In the hash table 410 of FIG. 4, a portion indicated in gray is a portion where the key identifier is registered.

ハッシュ・テーブル410にキー識別子が登録されると、このキー識別子のマップ420が作成される。このマップ420には、タイムスタンプ情報(timeStamp)、CRUD値(crudVal)、データオブジェクト(entryObj)が記録されたマップエントリがタイムスタンプ情報の降順(すなわち時系列)で並べられている。データオブジェクトは、マップエントリに対応するキャッシュされたレコードの内容へのポインタであり、初期的には「null」となる。例えば、図4に示すマップエントリ421には、タイムスタンプ情報「TS1」、CRUD値「U(更新)」、データオブジェクト「null」が記録されている。   When a key identifier is registered in the hash table 410, a map 420 of this key identifier is created. In this map 420, map entries in which time stamp information (timeStamp), CRUD value (crudVal), and data object (entryObj) are recorded are arranged in descending order (that is, time series) of the time stamp information. The data object is a pointer to the contents of the cached record corresponding to the map entry, and is initially “null”. For example, the time stamp information “TS1”, the CRUD value “U (update)”, and the data object “null” are recorded in the map entry 421 shown in FIG.

マップ420は、データベース110に格納されているデータであって、ハッシュ・テーブル410に登録されていない所定のキー識別子を持つデータが、アクセス部120により初めてアクセスされた際に作成される。この際、各マップエントリのデータオブジェクトの項目には「null」が記録される。これ以降、このキー識別子を持ち、所定のタイムスタンプ情報を持つレコードが読み出されると、キー識別子およびタイムスタンプ情報が対応するマップエントリのデータオブジェクトの項目に、データベース110から読み出されてデータ保持部130にキャッシュされたレコードの内容へのポインタが記録される。図4に示す例では、マップエントリ422において、データオブジェクトに、対応するレコードの内容が記録されている。   The map 420 is created when data having a predetermined key identifier that is stored in the database 110 and is not registered in the hash table 410 is accessed by the access unit 120 for the first time. At this time, “null” is recorded in the data object field of each map entry. Thereafter, when a record having this key identifier and having predetermined time stamp information is read, the key identifier and the time stamp information are read from the database 110 to the data object field of the corresponding map entry, and the data holding unit A pointer to the contents of the cached record is recorded in 130. In the example shown in FIG. 4, in the map entry 422, the contents of the corresponding record are recorded in the data object.

クエリにて指定されたキー識別子を持つデータが存在しない場合、キャッシュ管理部140は、そのキー識別子のマップを作成することができない。この場合、キャッシュ管理部140は、そのキー識別子をハッシュ・テーブル410に登録し、マップ420の代わりに、そのキー識別子を持つデータが存在しないことを示すデータを対応付けてデータ保持部130に保持させる。図4に示す例では、データ423が、該当するキー識別子を持つデータが存在しないことを示している。   If there is no data having the key identifier specified in the query, the cache management unit 140 cannot create a map of the key identifier. In this case, the cache management unit 140 registers the key identifier in the hash table 410 and stores in the data storage unit 130 data indicating that there is no data having the key identifier in place of the map 420. Let In the example shown in FIG. 4, the data 423 indicates that there is no data having the corresponding key identifier.

上記のマップの作成は、キャッシュ管理部140が、対象とするキー識別子を持つ各レコードからタイムスタンプ情報とCRUD値だけをフェッチする専用のクエリを発行することで実行される。マップ作成用のクエリの具体的な内容は、元のデータフェッチの内容(クエリ)によって異なる。例えば、「主照会でバインドされたキー識別子を持つ(複数の)レコードに対して、指定されたタイムスタンプ情報以前で最新の1レコードを副照会で選択し、そのCRUD値が「D(削除)」でないものを返す」というようなデータフェッチが行われる場合を考える。このようなアクセスが行われる際のクエリ(SQL文)は、例えば図6に示すようなものになる。そして、これに対応するマップを作成するための専用のクエリとクエリ結果からデータ構造を生成するコードは、図7のようになる。   The creation of the map is executed by the cache management unit 140 issuing a dedicated query for fetching only the time stamp information and the CRUD value from each record having the target key identifier. The specific contents of the map creation query differ depending on the original data fetch contents (query). For example, “for the record (s) having the key identifier bound in the main query, the latest record before the specified time stamp information is selected in the subquery, and its CRUD value is“ D (delete) Consider a case where a data fetch such as “return non-return” is performed. The query (SQL sentence) when such access is performed is as shown in FIG. 6, for example. And the code | cord | chord which produces | generates a data structure from the query for exclusive use for creating the map corresponding to this and a query result becomes like FIG.

ところで、ハッシュ・テーブル410にキー識別子およびマップ420が存在するデータに対して、読み出し以外のアクセスが行われた場合は、データベース110における新たなレコードの生成(インサート)を伴うため、データベース110に格納されているレコードとマップ420の内容とが整合しなくなる。この場合、キャッシュ管理部140は、そのキー識別子についてのキャッシュを一旦解放する。すなわち、ハッシュ・テーブル410のキー識別子およびキー識別子に対応付けられたマップ420を削除し、さらにマップ420のマップエントリに対応付けられて保持されたレコードも削除する。そして、同一のキー識別子について次にアクセスが行われた際に、再びハッシュ・テーブル410への登録およびマップの作成を行う。   By the way, when an access other than reading is performed on the data in which the key identifier and the map 420 exist in the hash table 410, a new record is generated (inserted) in the database 110 and stored in the database 110. The recorded record and the contents of the map 420 do not match. In this case, the cache management unit 140 once releases the cache for the key identifier. That is, the key identifier of the hash table 410 and the map 420 associated with the key identifier are deleted, and the record held in association with the map entry of the map 420 is also deleted. Then, when the same key identifier is next accessed, registration to the hash table 410 and creation of a map are performed again.

また、データベース110に新しいレコードが生成された際にキャッシュを解放するのではなく、マップ420を更新して対応することも可能である。データベース110に対するレコードの生成は最新のタイムスタンプ情報を付して行われる。そこで、キャッシュ管理部140は、新しいマップエントリを作成し、タイムスタンプ情報、CRUD値、データオブジェクトをセットした後、データ保持部130内の該当するマップ420の先頭に、この新たなマップエントリを追加する。   Further, instead of releasing the cache when a new record is generated in the database 110, the map 420 can be updated to cope with it. A record for the database 110 is generated with the latest time stamp information. Therefore, the cache management unit 140 creates a new map entry, sets time stamp information, a CRUD value, and a data object, and then adds this new map entry to the top of the corresponding map 420 in the data holding unit 130. To do.

ここで、データベース110が更新されたか否かのチェックは、従来技術をそのまま適用可能であるが、本実施形態における、マップ420によってキャッシュを管理するという構造を利用して、次のような簡単な方法でも行うことができる。すなわち、データベース110内で、与えられたキー識別子をもつレコードの数を返す軽量なクエリを発行し、キャッシュされているデータが使用可能かチェックするという方法である。クエリからの戻り値が、現在のマップ420のエントリ数と合致すれば、このキー識別子に関し、マップ420の作成以後データベース110の更新はないと判断できる。したがって、キャッシュされているデータはそのまま使用可能である。一方、戻り値がマップ420のエントリ数よりも大きい場合は、マップ420の作成以後データベース110に変更があったと判断できる。したがって、上記のような処理(キャッシュの解放またはマップ420の更新)が行われる。なお、レコード数を返す軽量なクエリは、例えば図7で示されるようなマップ420の作成手続きの場合、
“select count(*) from TABLE where KEY_IDFR = ?”
のようになる。
Here, for checking whether the database 110 has been updated, the conventional technique can be applied as it is. However, by using the structure of managing the cache by the map 420 in this embodiment, the following simple process is possible. It can also be done by the method. That is, it is a method of issuing a lightweight query that returns the number of records having a given key identifier in the database 110 and checking whether the cached data is usable. If the return value from the query matches the number of entries in the current map 420, it can be determined that the database 110 has not been updated since the map 420 was created for this key identifier. Therefore, the cached data can be used as it is. On the other hand, if the return value is greater than the number of entries in the map 420, it can be determined that the database 110 has changed since the map 420 was created. Therefore, the above processing (cache release or map 420 update) is performed. Note that a lightweight query that returns the number of records is, for example, a procedure for creating a map 420 as shown in FIG.
“Select count (*) from TABLE where KEY_IDFR =?”
become that way.

図4に示したデータ構造を用いれば、ハッシュ・テーブル410にキー識別子が登録されたデータに関しては、データベース110においてそのキー識別子を持つ全てのレコードに関するタイムスタンプ情報を含む情報がマップ420に記録される。したがって、クエリに付与されたタイムスタンプ情報を基準としてどのようなレコードを取得しようとする場合にも、そのレコードがマップ420上のどのエントリに対応し、そのレコードの内容がキャッシュされているか否かを判断することができる。したがって、該当するレコードがキャッシュされていれば、そのレコードを読み出して返し、該当するレコードがキャッシュされていなければ、アクセス部120によるデータベース110の検索に移行した後、検索結果を取得してデータ保持部130にキャッシュすれば良い。また、既に検索が行われたもののデータベース110にデータが存在しないことが分かっている所定のキー識別子に関して、ハッシュ・テーブル410にデータが存在しないことを示す情報を対応付けることで、データベース110を実際に検索することなく、所望のデータが存在しないことを認識することができる。   If the data structure shown in FIG. 4 is used, with respect to data in which the key identifier is registered in the hash table 410, information including time stamp information regarding all records having the key identifier in the database 110 is recorded in the map 420. The Therefore, when any record is to be acquired based on the time stamp information given to the query, which record corresponds to which entry on the map 420 and whether or not the content of the record is cached. Can be judged. Therefore, if the corresponding record is cached, the record is read and returned. If the corresponding record is not cached, the access unit 120 moves to the database 110 search, and then the search result is acquired and data is retained. The cache may be cached in the unit 130. Further, by associating information indicating that no data exists in the hash table 410 with a predetermined key identifier that has already been searched but is known to have no data in the database 110, the database 110 is actually Without searching, it can be recognized that the desired data does not exist.

<キャッシュシステムの動作>
次に、データ保持部130、キャッシュ管理部140およびマップ作成部150により構成されるキャッシュシステムの動作について説明する。
図8は、キャッシュシステムの動作の流れを示すフローチャートである。
キー識別子およびタイムスタンプ情報が指定されたクエリによりデータの読み出しが行われると、アクセス部120は、キャッシュ管理部140に該当するデータのキャッシュ検索を行わせる(ステップ801)。キャッシュ管理部140は、アクセス部120の指示に基づき、まず、クエリで指定されているキー識別子がハッシュ・テーブル410に登録されているか否かを調べる。
<Operation of the cache system>
Next, the operation of the cache system configured by the data holding unit 130, the cache management unit 140, and the map creation unit 150 will be described.
FIG. 8 is a flowchart showing the operation flow of the cache system.
When data is read by a query in which a key identifier and time stamp information are specified, the access unit 120 causes the cache management unit 140 to perform a cache search for the corresponding data (step 801). Based on an instruction from the access unit 120, the cache management unit 140 first checks whether the key identifier specified in the query is registered in the hash table 410.

クエリで指定されたキー識別子がハッシュ・テーブル410に登録されている場合(ステップ802でYes)、次にキャッシュ管理部140は、そのキー識別子に対応付けられたマップ420を探索する(ステップ803)。クエリで指定されたタイムスタンプ情報に基づく条件に合致するレコードがキャッシュされているならば(ステップ804でYes)、キャッシュ管理部140は、そのレコードを読み出してアクセス部120に返す(ステップ805)。   When the key identifier specified by the query is registered in the hash table 410 (Yes in Step 802), the cache management unit 140 next searches the map 420 associated with the key identifier (Step 803). . If a record matching the condition based on the time stamp information specified by the query is cached (Yes in step 804), the cache management unit 140 reads the record and returns it to the access unit 120 (step 805).

一方、マップ420を探索した結果、クエリで指定されたタイムスタンプ情報に基づく条件に合致するレコードがキャッシュされていない場合(ステップ804でNo)、すなわちデータオブジェクトが「null」の場合は、キャッシュ管理部140は、その結果をアクセス部120に返す。そして、アクセス部120によるデータベース110の検索結果を取得し(ステップ806)、データベース110から読み出されたレコードをマップ420のマップエントリに対応付けてキャッシュする(ステップ807)。   On the other hand, as a result of searching the map 420, if the record that matches the condition based on the time stamp information specified by the query is not cached (No in step 804), that is, if the data object is “null”, the cache management The unit 140 returns the result to the access unit 120. Then, the search result of the database 110 by the access unit 120 is acquired (step 806), and the record read from the database 110 is cached in association with the map entry of the map 420 (step 807).

これに対し、クエリで指定されたキー識別子がハッシュ・テーブル410に登録されていない場合(ステップ802でNo)、キャッシュ管理部140は、クエリに合致するレコードがキャッシュされていないことをアクセス部120に通知して、そのキー識別子をハッシュ・テーブル410に登録する(ステップ808)。また、キャッシュ管理部140は、マップ420を作成するための専用のクエリを発行する(ステップ809)。   On the other hand, when the key identifier specified by the query is not registered in the hash table 410 (No in step 802), the cache management unit 140 indicates that the record matching the query is not cached. And the key identifier is registered in the hash table 410 (step 808). The cache management unit 140 issues a dedicated query for creating the map 420 (step 809).

クエリで指定されたキー識別子を持つデータがデータベース110に存在するならば(ステップ810でYes)、そのキー識別子を持つレコードのタイムスタンプ情報等の情報が得られる。この場合、キャッシュ管理部140は、得られた情報に基づいてマップ420を作成する(ステップ811)。次に、キャッシュ管理部140は、アクセス部120によるデータベース110の検索結果を取得し(ステップ812)、データベース110から読み出されたレコードをマップ420のマップエントリに対応付けてキャッシュする(ステップ813)。   If data having the key identifier specified by the query exists in the database 110 (Yes in step 810), information such as time stamp information of the record having the key identifier is obtained. In this case, the cache management unit 140 creates the map 420 based on the obtained information (step 811). Next, the cache management unit 140 acquires the search result of the database 110 by the access unit 120 (step 812), and caches the record read from the database 110 in association with the map entry of the map 420 (step 813). .

一方、クエリで指定されたキー識別子を持つデータがデータベース110に存在しない場合(ステップ810でNo)、そのキー識別子に対するマップ420を作成することはできない。この場合、キャッシュ管理部140は、ステップ808でハッシュ・テーブル410に登録したキー識別子に対応付けて、データが存在しないことを示す情報をデータ保持部130に保持させる(ステップ814)。   On the other hand, when the data having the key identifier specified by the query does not exist in the database 110 (No in step 810), the map 420 for the key identifier cannot be created. In this case, the cache management unit 140 causes the data holding unit 130 to hold information indicating that no data exists in association with the key identifier registered in the hash table 410 in step 808 (step 814).

<キャッシュのデータ構造の他の例>
本実施形態によるキャッシュシステムにおけるキャッシュのデータ構造は、キー識別子を登録するハッシュ・テーブル410と、同一のキー識別子を持つレコードを時系列に管理するマップ420との組み合わせで構成される。ここで、ハッシュ・テーブル410やマップ420の構成自体は、データフェッチの内容に応じた変更が可能である。
<Other examples of cache data structure>
The data structure of the cache in the cache system according to the present embodiment is composed of a combination of a hash table 410 for registering key identifiers and a map 420 for managing records having the same key identifier in time series. Here, the configuration itself of the hash table 410 and the map 420 can be changed according to the contents of the data fetch.

図9に示すクエリ(SQL文)を考える。このクエリは、キー識別子とタイムスタンプ情報を与えてフェッチするのは図6の例と同じであるが、副照会の中で、主照会で指定のないカラム(IDFR2)をバインドしている。これは、指定したキー識別子を持つレコードのうち、IDFR2値が同じものの中で最新のタイムスタンプを持つレコードのセットを副照会が返すので、このうちCRUD値が「D(削除)」でないものだけを最終的に返す。   Consider the query (SQL statement) shown in FIG. In this query, fetching with a key identifier and time stamp information is the same as in the example of FIG. 6, but a column (IDFR2) not specified in the main query is bound in the subquery. This is because the subquery returns a set of records having the latest time stamp among the records having the specified key identifier among the records having the specified key identifier, and only those whose CRUD value is not “D (delete)”. Finally return.

図10は、このようなクエリに対応するキャッシュのデータ構造の例を示す図である。
図10に示すデータ構造では、ハッシュ・テーブル410とマップ420の間に補助エントリ(Auxiliary entries)430が設けられ、クエリの実行に伴って段階的に指定されるキー識別子が、ハッシュ・テーブル410と補助エントリ430により階層的に登録される。そして、補助エントリ430に登録された最下層のキー識別子に対応付けてマップ420が登録される。
FIG. 10 is a diagram illustrating an example of a data structure of a cache corresponding to such a query.
In the data structure shown in FIG. 10, auxiliary entries (Auxiliary entries) 430 are provided between the hash table 410 and the map 420, and key identifiers specified step by step as the query is executed are The auxiliary entries 430 are registered hierarchically. Then, the map 420 is registered in association with the lowest layer key identifier registered in the auxiliary entry 430.

図10に示すデータ構造におけるマップを作成するための専用のクエリおよびクエリ結果からデータ構造を生成するコードは、図11のようになる。図11のクエリが実行されると、ハッシュ・テーブル410のエントリから、IDFR2が昇順に並んだ補助エントリ430のリストを経由して、各IDFR2の値ごとにタイムスタンプ順で並んだマップ420が作成される。この状態のキャッシュに対して、所定のキー識別子およびタイムスタンプ情報が指定されたクエリが受け付けられると、例えば、図10の一点鎖線で囲まれたエントリの集合が特定される。そして、必要ならばデータベース110にアクセスして、クエリに対応するデータオブジェクト(entryObj)のレコードを取得した後、CRUD値が「D(削除)」のものを除外したオブジェクトの集合が返される。   FIG. 11 shows a code for generating a data structure from a dedicated query for creating a map in the data structure shown in FIG. 10 and a query result. When the query of FIG. 11 is executed, a map 420 arranged in time stamp order for each value of IDFR2 is created from the entry of the hash table 410 via the list of auxiliary entries 430 in which IDFR2 is arranged in ascending order. Is done. When a query in which a predetermined key identifier and time stamp information are specified is accepted for the cache in this state, for example, a set of entries surrounded by a one-dot chain line in FIG. 10 is specified. Then, if necessary, the database 110 is accessed to obtain a record of the data object (entryObj) corresponding to the query, and then a set of objects excluding the CRUD value “D (deleted)” is returned.

以上、クエリの実行に伴って段階的にキー識別子が指定される場合に適したデータ構造について説明した。クエリの内容によっては、さらに数段階にわたって補助エントリ430を設けることも可能である。   As described above, the data structure suitable for the case where the key identifier is specified step by step as the query is executed has been described. Depending on the contents of the query, auxiliary entries 430 can be provided in several stages.

以上、本実施形態について説明したが、本発明の技術的範囲は上記実施形態に記載の範囲には限定されない。例えば、上記実施形態では、クエリがキー識別子とタイムスタンプ情報を指定して発行されるために、マップにおいて各マップエントリをレコードに対応付けるためにタイムスタンプ情報を用いた。これに対し、クエリに対応するレコードを一意に特定できる他の情報を適宜用いてマップを作成しても良い。その他、上記実施形態に、種々の変更または改良を加えたものも、本発明の技術的範囲に含まれることは、特許請求の範囲の記載から明らかである。   As mentioned above, although this embodiment was described, the technical scope of this invention is not limited to the range as described in the said embodiment. For example, in the above embodiment, since the query is issued by designating the key identifier and the time stamp information, the time stamp information is used to associate each map entry with the record in the map. On the other hand, the map may be created by appropriately using other information that can uniquely identify the record corresponding to the query. In addition, it is clear from the description of the scope of the claims that various modifications or improvements added to the above embodiment are also included in the technical scope of the present invention.

本実施形態が適用されるデータベースシステムの機能構成例を示す図である。It is a figure which shows the function structural example of the database system to which this embodiment is applied. データベースシステムを構成するコンピュータのハードウェア構成例を示す図である。It is a figure which shows the hardware structural example of the computer which comprises a database system. 本実施形態のデータベースの構成例を示す図である。It is a figure which shows the structural example of the database of this embodiment. 本実施形態におけるキャッシュのデータ構造の例を示す図である。It is a figure which shows the example of the data structure of the cache in this embodiment. 図4におけるマップエントリのデータ構造の例を示す図である。It is a figure which shows the example of the data structure of the map entry in FIG. データフェッチのためのクエリの例を示す図である。It is a figure which shows the example of the query for data fetch. 図6のクエリに対応する本実施形態のマップを作成するための専用のクエリとクエリ結果からデータ構造を生成するコードの例を示す図である。It is a figure which shows the example of the code | cord | chord which produces | generates a data structure from the query for exclusive use for creating the map of this embodiment corresponding to the query of FIG. 6, and a query result. 本実施形態のキャッシュシステムの動作の流れを示すフローチャートである。It is a flowchart which shows the flow of operation | movement of the cache system of this embodiment. データフェッチのためのクエリの他の例を示す図である。It is a figure which shows the other example of the query for a data fetch. 図9のクエリに対応する本実施形態のキャッシュのデータ構造の例を示す図である。It is a figure which shows the example of the data structure of the cache of this embodiment corresponding to the query of FIG. 図10に示すデータ構造におけるマップを作成するための専用のクエリおよびクエリ結果からデータ構造を生成するコードの例を示す図である。It is a figure which shows the example of the code | cord | chord which produces | generates a data structure from the query for exclusive use for creating the map in the data structure shown in FIG. 10, and a query result.

符号の説明Explanation of symbols

100…データベースシステム、110…データベース、120…アクセス部、130…データ保持部、140…キャッシュ管理部、150…マップ作成部、410…ハッシュ・テーブル、420…マップ、421、422…マップエントリ DESCRIPTION OF SYMBOLS 100 ... Database system, 110 ... Database, 120 ... Access part, 130 ... Data holding part, 140 ... Cache management part, 150 ... Map creation part, 410 ... Hash table, 420 ... Map, 421, 422 ... Map entry

Claims (10)

データの作成、更新、削除が行われるたびに同一の識別情報が付与された当該データのレコードを追加するデータベースにおいて、
前記データベースから読み出されたデータをキャッシュする保持部と、
前記保持部にキャッシュされるデータを管理する管理部とを備え、
前記保持部は、
データの前記識別情報を登録するテーブルと、
前記テーブルに登録された前記識別情報に個別に対応付けられ、前記データベースにおける当該識別情報を持つレコードを示すエントリを格納するマップとを備え、
前記管理部は、
前記識別情報およびレコードを指定する情報を含むクエリを受け付けて前記保持部を検索し、
該当するデータがキャッシュされていれば当該データを読み出し、
該当するデータがキャッシュされていなければ、当該データを前記データベースから取得し、前記保持部の前記マップにおける当該クエリにより指定された識別情報およびレコードに対応する前記エントリに関連付けて当該データをキャッシュさせる、システム。
In a database that adds a record of the data with the same identification information every time data is created, updated, or deleted,
A holding unit that caches data read from the database;
A management unit that manages data cached in the holding unit;
The holding part is
A table for registering the identification information of the data;
A map for storing an entry indicating a record having the identification information in the database, individually associated with the identification information registered in the table,
The management unit
Accepting a query including information specifying the identification information and a record, searching the holding unit,
If the corresponding data is cached, read the data,
If the corresponding data is not cached, the data is acquired from the database, and the data is cached in association with the entry corresponding to the identification information and record specified by the query in the map of the holding unit. system.
前記マップは、前記データベースに格納されており、前記テーブルに登録されていない所定の識別情報を持つデータに対して初めてアクセスが行われた際に生成される、請求項1に記載のシステム。 The system according to claim 1, wherein the map is generated when the data is stored in the database and has the predetermined identification information that is not registered in the table for the first time. 前記マップの前記エントリには、前記レコードが作成された際に当該レコードに付与される時間情報が記録され、
前記管理部は、前記レコードを指定する情報として前記時間情報が一意に定まる条件を記載したクエリを受け付け、当該条件にしたがって特定される時間情報を持つエントリを、当該クエリにより指定されたレコードを示すエントリとする、請求項1に記載のシステム。
In the entry of the map, time information given to the record when the record is created is recorded,
The management unit accepts a query that describes a condition for uniquely determining the time information as information for designating the record, and indicates an entry having time information specified according to the condition as a record designated by the query The system according to claim 1, wherein the system is an entry.
前記時間情報は、前記レコードが作成される原因となった前記データに対する操作が行われた時刻を表すタイムスタンプである、請求項3に記載のシステム。 The system according to claim 3, wherein the time information is a time stamp indicating a time when an operation is performed on the data that causes the record to be created. クエリにより指定された前記識別情報を持つデータが前記データベースに存在しない場合、その旨を示す情報が、前記テーブルに登録された当該識別情報に対応付けられて前記保持部に保持される、請求項1に記載のシステム。 The data indicating that when the data having the identification information specified by the query does not exist in the database, the information indicating that is stored in the holding unit in association with the identification information registered in the table. The system according to 1. クエリの実行により前記識別情報が段階的に指定される場合、前記テーブルと前記マップの間に補助エントリが設けられ、当該クエリに記述された最上位の識別情報が当該テーブルに登録され、当該クエリの実行により得られる下位の識別情報が当該テーブルの識別情報に対応付けられて当該補助エントリに登録され、当該補助エントリに登録された最下位の識別情報に当該マップが対応付けられる、請求項1に記載のシステム。 When the identification information is specified in stages by executing a query, an auxiliary entry is provided between the table and the map, and the highest-level identification information described in the query is registered in the table. The lower-level identification information obtained by executing is registered in the auxiliary entry in association with the identification information in the table, and the map is associated with the lowest-level identification information registered in the auxiliary entry. The system described in. 前記データベースにおいて所定の識別情報を持つデータのレコードが追加された場合に、前記保持部において、前記テーブルに登録された当該識別情報および当該識別情報に対応付けられた前記マップが削除され、当該マップのエントリに関連付けられたデータがキャッシュされているときはキャッシュされている当該データも削除される、請求項1に記載のシステム。 When a record of data having predetermined identification information is added in the database, the holding unit deletes the identification information registered in the table and the map associated with the identification information, and the map 2. The system of claim 1, wherein when data associated with the entry is cached, the cached data is also deleted. 前記データベースにおいて所定の識別情報を持つデータのレコードが追加された場合に、当該識別情報に対応付けられた前記マップに、当該レコードに関連付けられたエントリが追加される、請求項1に記載のシステム。 The system according to claim 1, wherein when a record of data having predetermined identification information is added in the database, an entry associated with the record is added to the map associated with the identification information. . データの作成、更新、削除が行われるたびに同一の識別情報が付与された当該データのレコードを追加するデータベースのキャッシュ方法であって、
前記識別情報およびレコードを指定する情報を含むクエリを受け付け、データの前記識別情報を登録するテーブルに対して、当該クエリにより指定された識別情報を検索するステップと、
前記テーブルに前記クエリにより指定された識別情報が存在しない場合、当該識別情報を当該テーブルに登録し、当該識別情報に対応づけて前記データベースにおける当該識別情報を持つレコードを示すエントリを格納するマップを生成するステップと、
前記テーブルに前記クエリにより指定された識別情報が存在する場合、当該識別情報に対応付けられた前記マップの前記エントリに関連付けられたデータがキャッシュされているならば当該データを読み出し、当該エントリに関連付けられたデータがキャッシュされていないならば前記データベースから読み出された当該データを当該エントリに関連付けてキャッシュさせるステップと
を含む、方法。
A database caching method for adding a record of the data with the same identification information every time data is created, updated, or deleted,
Receiving a query including the identification information and information specifying a record, and searching the identification information specified by the query against a table for registering the identification information of data;
When the identification information specified by the query does not exist in the table, the identification information is registered in the table, and a map storing an entry indicating a record having the identification information in the database is associated with the identification information. Generating step;
When the identification information specified by the query exists in the table, if the data associated with the entry of the map associated with the identification information is cached, the data is read and associated with the entry Caching the retrieved data from the database in association with the entry if the data is not cached.
データの作成、更新、削除が行われるたびに同一の識別情報が付与された当該データのレコードを追加するデータベースシステムを制御するコンピュータに、
前記識別情報およびレコードを指定する情報を含むクエリを受け付け、データの前記識別情報を登録するテーブルに対して、当該クエリにより指定された識別情報を検索する処理と、
前記テーブルに前記クエリにより指定された識別情報が存在しない場合、当該識別情報を当該テーブルに登録し、当該識別情報に対応づけてデータベースにおける当該識別情報を持つレコードを示すエントリを格納するマップを生成する処理と、
前記テーブルに前記クエリにより指定された識別情報が存在する場合、当該識別情報に対応付けられた前記マップの前記エントリに関連付けられたデータがキャッシュされているならば当該データを読み出し、当該エントリに関連付けられたデータがキャッシュされていないならば前記データベースから読み出された当該データを当該エントリに関連付けてキャッシュさせる処理と
を実行させる、プログラム。
To the computer that controls the database system that adds a record of the data to which the same identification information is assigned every time data is created, updated, or deleted,
A process of accepting a query including information specifying the identification information and a record, and searching the identification information specified by the query against a table that registers the identification information of data;
If the identification information specified by the query does not exist in the table, the identification information is registered in the table, and a map that stores an entry indicating a record having the identification information in the database in association with the identification information is generated. Processing to
When the identification information specified by the query exists in the table, if the data associated with the entry of the map associated with the identification information is cached, the data is read and associated with the entry A program for executing a process of caching the data read from the database in association with the entry if the read data is not cached.
JP2008112945A 2008-04-23 2008-04-23 Database cache system Expired - Fee Related JP5186270B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008112945A JP5186270B2 (en) 2008-04-23 2008-04-23 Database cache system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008112945A JP5186270B2 (en) 2008-04-23 2008-04-23 Database cache system

Publications (2)

Publication Number Publication Date
JP2009265840A JP2009265840A (en) 2009-11-12
JP5186270B2 true JP5186270B2 (en) 2013-04-17

Family

ID=41391638

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008112945A Expired - Fee Related JP5186270B2 (en) 2008-04-23 2008-04-23 Database cache system

Country Status (1)

Country Link
JP (1) JP5186270B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5483561B2 (en) 2010-02-25 2014-05-07 楽天株式会社 Storage device, server device, storage system, database device, data providing method, and program
EP3528141A4 (en) * 2016-10-17 2020-05-13 Nippon Telegraph And Telephone Corporation Data processing device and data processing method
US11514083B2 (en) 2016-12-22 2022-11-29 Nippon Telegraph And Telephone Corporation Data processing system and data processing method
KR102195838B1 (en) 2019-04-10 2020-12-28 주식회사 티맥스 소프트 Method for managing database
CN113268506B (en) * 2021-05-24 2023-09-26 北京京东振世信息技术有限公司 Query method and device of cache database, electronic equipment and readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5499367A (en) * 1991-11-15 1996-03-12 Oracle Corporation System for database integrity with multiple logs assigned to client subsets
US20060218200A1 (en) * 2005-03-24 2006-09-28 International Business Machines Corporation Application of log records by storage servers

Also Published As

Publication number Publication date
JP2009265840A (en) 2009-11-12

Similar Documents

Publication Publication Date Title
US8868595B2 (en) Enhanced control to users to populate a cache in a database system
US7526469B2 (en) Method and system of database management with shared area
US9031923B2 (en) System for accessing shared data using multiple application servers
EP1808780B1 (en) Determination of database statistics using application logic
JP2012174096A (en) Computer system and data management method
WO2012095771A1 (en) Sparse index table organization
JP5186270B2 (en) Database cache system
US20050278398A1 (en) Storage system
JP5160483B2 (en) Storage system and data migration compatible search system
US20090157621A1 (en) Search device, search method and search program
JP2009146084A (en) Table management device
US20080082535A1 (en) Method and system for automatically generating a communication interface
US11327962B1 (en) Real-time analytical database system for querying data of transactional systems
EP1967968B1 (en) Sharing of database objects
JP2001195197A (en) Digital data sub-system including directory to efficiently provide format information about stored record
WO2015105043A1 (en) Computing system, database management device and computing method
JP2004192657A (en) Information retrieval system, and recording medium recording information retrieval method and program for information retrieval
JP4825504B2 (en) Data registration / retrieval system and data registration / retrieval method
US7809766B2 (en) Writable shared database objects
US7685107B2 (en) Apparatus, system, and method for scanning a partitioned data set
US20220245113A1 (en) Index for multi-level data structures
US20230359605A1 (en) Autonomous Refactoring System for Database
CN111444179B (en) Data processing method, device, storage medium and server
JP5673224B2 (en) Information management apparatus, information management method, and program
JP5696280B1 (en) Term unification system, term unification program, and term unification method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110119

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120828

RD14 Notification of resignation of power of sub attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7434

Effective date: 20120830

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121109

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130121

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees