JP6411232B2 - Sampling apparatus and sampling program - Google Patents
Sampling apparatus and sampling program Download PDFInfo
- Publication number
- JP6411232B2 JP6411232B2 JP2015015094A JP2015015094A JP6411232B2 JP 6411232 B2 JP6411232 B2 JP 6411232B2 JP 2015015094 A JP2015015094 A JP 2015015094A JP 2015015094 A JP2015015094 A JP 2015015094A JP 6411232 B2 JP6411232 B2 JP 6411232B2
- Authority
- JP
- Japan
- Prior art keywords
- sampling
- record
- leaf
- records
- sparse density
- 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.)
- Active
Links
Images
Description
本発明の実施形態は、サンプリング装置およびサンプリングプログラムに関する。 Embodiments described herein relate generally to a sampling device and a sampling program.
一般的に、データベースのレコードをランダムサンプリングする場合、多くの外れ値が混入し、元のデータとは分布状況が異なり、正しい解析結果が得られないおそれがある。 In general, when random sampling is performed on records in a database, many outliers are mixed in, and the distribution situation is different from the original data, and there is a possibility that a correct analysis result cannot be obtained.
元のデータの分布状況を保ったまま、高速にデータのサンプリングを行いたいとの要請に応えるものとして、索引情報を持つB-Tree インデックスを利用して高速にサンプリングを行うことが行われている。 Sampling at high speed using a B-Tree index with index information has been performed as a response to the request to sample data at high speed while maintaining the distribution of the original data. .
B-Tree インデックスを使用して1次元のデータの外れ値を検出する場合、他の点(レコードのKey 値)間の距離に比べ、点(レコードのKey 値)間の距離が離れている点(レコードのKey 値)が外れ値となる。 When detecting outliers in one-dimensional data using B-Tree index, the distance between points (Key value of record) is farther than the distance between other points (Key value of record) (Key value of the record) is an outlier.
厳密に外れ値を検出するためには、全てのレコードについて事前の計算(クラスタリング)が必要である。一般的に、インデックスの情報はサイズの関係上、ハードディスク装置に保持されるので、クラスタリングを行うには、ハードディスク装置からのリードと、O(nlogn)の計算コストが必要である、という問題があった。 In order to detect outliers strictly, a prior calculation (clustering) is required for all records. In general, since the index information is stored in the hard disk device due to its size, there is a problem that the read from the hard disk device and the calculation cost of O (nlogn) are necessary for clustering. It was.
本発明が解決しようとする課題は、1次元データをクラスタリングなどで分類すること無く、データの分布を保ったまま、外れ値を除外したランダムサンプリングを高速に行うことができるサンプリング装置およびサンプリングプログラムを提供することである。 A problem to be solved by the present invention is to provide a sampling apparatus and a sampling program capable of performing random sampling at high speed without excluding outliers while maintaining the data distribution without classifying one-dimensional data by clustering or the like. Is to provide.
実施形態のサンプリング装置は、データベースを構成する複数のレコードを記憶するレコード記憶部と、階層構造を成すとともに、索引情報をインデックスとして保持するB-Tree インデックスに加えて、前記レコード記憶部に記憶されるレコードに応じた、リーフブロック毎のKey 間の平均距離で表す疎密度と、全リーフブロックの前記疎密度の平均値と、全リーフブロックの前記疎密度の標準偏差と、子ノードのレコード数の付加情報を記憶するB-Tree インデックス記憶部と、ユーザーによる前記データベースからのランダムサンプリングを実行するとのクエリに対応して、サンプリング要求を行うアプリケーションと、前記アプリケーションからサンプリング要求を受け取り、サンプリング命令に変換する要求変換部と、前記要求変換部から受け取ったサンプリング命令を解釈してサンプリングレコードを決定し、前記レコード記憶部からサンプリングレコードを取得する場合、前記全リーフブロックの前記疎密度の平均値よりも値の大きな所定値以上の前記疎密度を持つリーフブロックは外れ値を含むとみなして除外し、除外されなかったリーフブロックからレコードを取得するデータ操作部とを、備える。 The sampling apparatus according to the embodiment is stored in the record storage unit in addition to a record storage unit that stores a plurality of records constituting the database and a B-Tree index that has a hierarchical structure and holds index information as an index. Sparse density expressed by the average distance between keys for each leaf block, the average value of the sparse density of all leaf blocks, the standard deviation of the sparse density of all leaf blocks, and the number of records of child nodes B-Tree index storage unit for storing additional information, an application that makes a sampling request in response to a query that the user performs random sampling from the database, a sampling request from the application, and a sampling instruction From the request conversion unit to be converted and the request conversion unit When the sampling instruction is determined by interpreting the sampled sampling instruction and the sampling record is acquired from the record storage unit, the sparse density not less than a predetermined value greater than the average value of the sparse density of all the leaf blocks And a data operation unit that obtains a record from a leaf block that is not excluded.
以下、本発明の一実施の形態について、図面を参照して説明する。尚、各図において同一箇所については同一の符号を付すとともに、重複した説明は省略する。 Hereinafter, an embodiment of the present invention will be described with reference to the drawings. In the drawings, the same portions are denoted by the same reference numerals, and redundant description is omitted.
まず、本実施形態で用いる主要な用語について説明する。 First, main terms used in the present embodiment will be described.
「レコード」とは、データベースを構成する単位のひとつで、データの1件分のことである。 A “record” is one of the units constituting a database and is one record of data.
「ルートノード」とは、B-Treeの一番上にあるノードをいう。 “Root node” refers to the node at the top of the B-Tree.
「リーフノード」とは、B-Tree上の一番下、リーフブロックとつながっているノードをいう。 A “leaf node” is a node connected to a leaf block at the bottom of the B-Tree.
「ブランチノード」とは、ルートノードとリーフノードの間にあるノードをいう。 “Branch node” refers to a node between a root node and a leaf node.
「リーフブロック」は、B-Treeインデックスにおいては、リーフノードとつながっている、検索するためのKeyの値とそのKeyに対応するレコードへのアドレスの組を指す。リーフブロックによっては、複数の組を保持する。 In the B-Tree index, “leaf block” refers to a set of a key value for searching and an address to a record corresponding to the key, connected to a leaf node. Some leaf blocks hold multiple sets.
「子ノード」とは、自分から枝が出ているノードをいう。自分の上のノードは親ノードである。 “Child node” means a node from which a branch comes out. The node above you is the parent node.
「サンプリング」とは、データ分析の際、データが巨大などの理由で一部のレコードを抽出することをいう。無作為にサンプリングを行うことランダムサンプリングという。本実施形態においては、B-Treeインデックスを利用して、リーフブロックからレコードをランダムサンプリングする。 “Sampling” refers to extracting a part of records for data analysis because the data is huge. Random sampling is a random sampling. In the present embodiment, records are randomly sampled from leaf blocks using a B-Tree index.
「外れ値」とは、他の値とは大きく異なり、計算によってはデータの傾向がつかめなくなる恐れのあるデータをいう。本実施形態においては、B-Treeインデックスを使用して1次元のデータの外れ値を検出するもので、他の点(レコードのKey 値)間の距離に比べ、点(レコードのKey 値)間の距離が離れている点(レコードのKey 値)が外れ値となる。 An “outlier” is data that is significantly different from other values and may cause a tendency of data to be uncertain depending on the calculation. In this embodiment, the B-Tree index is used to detect outliers in one-dimensional data. Compared to the distance between other points (record key values), the distance between points (record key values) The point where the distance of is far (the key value of the record) is an outlier.
「カーソル」とは、B-Tree上で、現在操作しているノードのポインタをいう。B-Treeでは、ルートノードやブランチノードが子ノードへのポインタをもち、カーソルはこの値を元に子ノードへ移動していく。 “Cursor” refers to the pointer of the currently operated node on the B-Tree. In B-Tree, the root node and branch node have pointers to child nodes, and the cursor moves to the child nodes based on this value.
「結果セット」とは、データベースから取り出されたレコード群(レコードの集合)をいう。データベースにSELECTなどの結果が帰ってくる命令を与えた場合に返却される。 “Result set” refers to a group of records (a set of records) extracted from a database. Returned when a command such as SELECT is returned to the database.
本実施形態においては、B-Treeからリーフブロック毎のKey間の平均距離の情報を疎密度として算出し、相対的に疎密度の値が大きいリーフブロックが外れ値を含むとみなして除外することで、厳密に外れ値を計算せずに、ランダムサンプリングを高速化させるものである。 In this embodiment, information on the average distance between keys for each leaf block from the B-Tree is calculated as sparse density, and leaf blocks with relatively large sparse density values are regarded as including outliers and excluded. Thus, random sampling is speeded up without strictly calculating outliers.
図1は、本発明の実施形態に係るサンプリング装置の概略構成を示すブロック図である。この装置は汎用のコンピュータ(例えばパーソナルコンピュータ(PC)等)と、同コンピュータ上で動作するソフトウェアとを用いて実現される。コンピュータとしては、CAD(Computer Aided Design)やCAE(Computer Aided Engineering)に好適なエンジニアリングワークステーション(EWS)等も含む。本実施形態はこのようなコンピュータに、データベースを構成する複数のレコードを記憶するレコード記憶部と、階層構造を成すとともに、索引情報をインデックスとして保持するB-Tree インデックスに加えて、レコード記憶部に記憶されるレコードに応じた、リーフブロック毎のKey 間の平均距離で表す疎密度と、全リーフブロックの疎密度の平均値と、全リーフブロックの疎密度の標準偏差と、子ノードのレコード数の付加情報を記憶するB-Tree インデックス記憶部とを備えるサンプリング装置に、ユーザーによるデータベースからのランダムサンプリングを実行するとのクエリに対応して、サンプリング要求を行う機能と、サンプリング要求をサンプリング命令に変換する機能と、サンプリング命令を解釈してサンプリングレコードを決定し、サンプリングレコードを取得する場合、全リーフブロックの疎密度の平均値よりも値の大きな所定値以上の疎密度を持つリーフブロックは外れ値を含むとみなして除外し、除外されなかったリーフブロックからレコードを取得する機能とを、実現させるためのサンプリングプログラムとして実施することもできる。 FIG. 1 is a block diagram showing a schematic configuration of a sampling apparatus according to an embodiment of the present invention. This apparatus is realized by using a general-purpose computer (for example, a personal computer (PC) or the like) and software operating on the computer. The computer includes an engineering workstation (EWS) suitable for CAD (Computer Aided Design) and CAE (Computer Aided Engineering). In this embodiment, in such a computer, in addition to a record storage unit that stores a plurality of records constituting the database and a B-Tree index that has a hierarchical structure and holds index information as an index, the record storage unit The sparse density expressed by the average distance between keys for each leaf block, the average value of the sparse density of all leaf blocks, the standard deviation of the sparse density of all leaf blocks, and the number of child node records according to the stored records In response to a query that the user performs random sampling from the database to a sampling device that has a B-Tree index storage unit that stores additional information, and a sampling request function, and converts the sampling request into a sampling command Function and interpret the sampling instruction to determine the sampling record When acquiring sampling records, leaf blocks with a sparse density greater than a predetermined value that is larger than the average value of the sparse density of all leaf blocks are considered to contain outliers, and excluded from the leaf blocks that were not excluded It can also be implemented as a sampling program for realizing the function of acquiring records.
図1に示すように、本実施形態に係るサンプリング装置1は、主として、アプリケーション11、要求変換部12、データ操作部13、レコード記憶部14、B-Treeインデックス記憶部15から構成されている。
As shown in FIG. 1, the
レコード記憶部14は、レコード記憶領域1、レコード記憶領域2、・・・等から成り、データベースを構成する複数のレコードを記憶するものである。データベースとしては、例えば、リレーショナルデータベースが該当するが、これに限定されるものではない。レコードは、例えば、テーブル形式で表すことができる。テーブルは、行と列で表される1次元データの集まりで、データのタイトルを表わす「列(またはカラム)」に対し、縦に並んでいるそれぞれのデータが「行(またはロウ)」であり、1行が1つのデータで、カラムがそれぞれの属性の値を表す。1件分のデータが、レコードである。
The
データ操作部13からランダムサンプリングを行うレコード記憶領域が指定された場合に、レコード記憶部14の該当するレコード記憶領域からレコードが取得される。レコードの取得の詳細については後述する。
When a record storage area for performing random sampling is designated from the
アプリケーション11は、サンプリング装置1のユーザーがコンピュータ上で実行したい作業を実行する機能を直接的に有するソフトウェアであって、本実施形態では、例えば、サンプリング装置1におけるサンプリング取得およびレコード更新の作業を実行させるものである。
The
アプリケーション11は、ユーザーによるデータベースからランダムサンプリングを実行するとのクエリに対応して、サンプリングレコード取得時には、要求変換部12に対してサンプリング要求を行う。サンプリング要求に際しては、(1)対象レコード記憶領域名、(2)取得するレコード数のテーブルに対する割合(%)、(3)除外するリーフブロックの割合(%)、を指定する。ここで、対象レコード記憶領域名は、レコード記憶部14に記憶される複数のレコード群のうち、サンプリングを実行するレコードの集合として特定されるものである。例えば、“TEST”のように名付けられる。
In response to the query that the user performs random sampling from the database, the
取得するレコードのテーブルに対する割合(%)は、サンプリングするレコードの数を、指定レコード記憶領域の割合で指定するものである。 The ratio (%) of the record to be acquired to the table specifies the number of records to be sampled by the ratio of the designated record storage area.
除外するリーフブロックの割合(%)は、リーフブロックの疎密度(後ほど詳述する)の分布を正規分布と仮定し、正規分布上で上位何%を除外するかを指定するものである。例えば、ユーザーは大きく外れているリーフブロックだけを除外したい場合には0.1%、確実に外れ値を除外したい場合には5%といった要求を出す。尚、取得するレコード数のテーブルに対する割合(%)に代えて、取得するレコード数そのものを指定することでもよい。さらに、除外するリーフブロックの割合(%) に代えて、除外するリーフブロック数そのものを指定することでもよい。 The ratio (%) of leaf blocks to be excluded designates what percentage is excluded from the top of the normal distribution, assuming that the distribution of sparse density (detailed later) of the leaf blocks is a normal distribution. For example, the user issues a request of 0.1% when it is desired to exclude only a leaf block that is significantly off, and 5% when it is desired to exclude an outlier. Note that the number of records to be acquired may be specified instead of the ratio (%) of the number of records to be acquired to the table. Furthermore, the number of leaf blocks to be excluded may be specified instead of the ratio (%) of the leaf blocks to be excluded.
ユーザーは、例えば、サンプリングレコードの取得をするために、データベース管理システムにおいてデータの操作や定義を行うためのデータベース言語であるSQLの一命令であるSELECT文で、サンプリング要求を次のように記述する。 For example, to acquire a sampling record, a user describes a sampling request as follows in a SELECT statement that is a command of SQL that is a database language for performing data manipulation and definition in a database management system. .
“SELECT * FROM TEST, RANDSAMPLE(10,5);”
このSELECT文では、ランダムサンプリングする対象レコード記憶領域が“TEST”という名のレコード記憶領域であり、サンプリングするレコード数の割合が10%、外れ値を除外する割合が5%と、指定されている。
“SELECT * FROM TEST, RANDSAMPLE (10,5);”
In this SELECT statement, the target record storage area to be randomly sampled is a record storage area named “TEST”, the ratio of the number of records to be sampled is 10%, and the ratio of excluding outliers is 5%. .
アプリケーション11は、ユーザーによるデータベースに対するレコード更新を実行するとのクエリに対応して、レコード更新時には、要求変換部12に対してレコード更新要求を出す。レコード更新は、例えば、Key値=6というレコードを対象レコード記憶領域に新たに挿入する要求である。
The
要求変換部12は、サンプリングレコード取得時には、上述のように指定されたサンプリング要求をアプリケーション11から受け取った後、サンプリング命令に変換する。変換後のサンプリング命令は、データ操作部13に送られる。
When acquiring the sampling record, the
要求変換部12は、レコード更新時には、レコード更新要求をアプリケーション11から受け取った後、レコード更新命令に変換する。
At the time of record update, the
データ操作部13は、サンプリングレコード取得時には、要求変換部12から受け取ったサンプリング命令を解釈して、サンプリングレコードを決定する。決定されたサンプリングレコードは、レコード記憶部14の指定されたレコード記憶領域から取得される。データ操作部13は、B-Tree インデックス記憶部15から読み込んだB-Tree を自己のメモリ(図示しない)上に構築し、ランダムに移動しながら読み込むレコードを決定する処理を行う。
When acquiring the sampling record, the
後述するように、疎密度に応じて除外すると判定されたリーフブロック以外に属するサンプリングレコードが、レコード群である結果セットとしてアプリケーション11に送られる。
As will be described later, sampling records belonging to other than leaf blocks determined to be excluded according to sparseness are sent to the
データ操作部13は、レコード更新時には、要求変換部12から受け取ったレコード更新命令を解釈して、レコードの更新を実行するレコード記憶領域を決定する。更新レコードは、レコード記憶部14の指定されたレコード記憶領域に書き込まれる。
At the time of record update, the
データ操作部13は、更新レコードに応じて、B-Tree を更新するためにデータを生成する。B-Tree を更新するデータは、B-Tree インデックス記憶部15に送られる。
The
B-Tree インデックス記憶部15は、B-Tree を恒久的に保存する場所であり、例えば、ハードディスク記憶装置で構成するのが好適である。B-Tree インデックス記憶部15には、B-Treeのルートノード、ブランチノード、リーフノード、リーフブロックの全てが保存される。
The B-Tree
本実施形態においては、レコード更新時には、データ操作部13から受け取ったB-Tree を更新するデータに応じて、(1)疎密度(リーフブロックの距離の平均値)、(2)全リーフブロックの疎密度の平均値、(3)全リーフブロックの疎密度の標準偏差、(4)子ノードのレコード数、の情報をB-Tree に付加したB-Tree インデックスを記憶するものである。尚、初期状態では、レコード記憶部14のレコード記憶領域1、レコード記憶領域2、・・・等に記憶されるレコードに応じた(1)疎密度(リーフブロックの距離の平均値)、(2)全リーフブロックの疎密度の平均値、(3)全リーフブロックの疎密度の標準偏差、(4)子ノードのレコード数の付加情報が記憶されている。
In this embodiment, at the time of record update, according to the data for updating the B-Tree received from the
B-Treeを使用する場合には、B-Tree インデックス記憶部15から一時的にメモリ(図示しない)上 にデータを読み込み、B-Treeを構築し処理を行う。しかし、B-Tree全てをメモリ上に構築するとサイズ制約があり、全リーフブロックをメモリ上に読み込めない場合がある。そこで、メモリ上にはルートノード、ブランチノード、リーフノードのみを構築しておき、必要に応じて、リーフブロックをB-Tree インデックス記憶部15から読み込む。従来の手法では、全レコードの情報を計算する必要があるため、全てのリーフブロックをハードディスク記憶装置から読み込んでいたが、本実施形態によれば、ランダムに移動した先のリーフブロックだけを読み込むだけでよいので、ハードディスク記憶装置の読み込み回数を減らせることができる。
When using a B-Tree, data is temporarily read from a B-Tree
<外れ値>
ランダムサンプリングを実行する場合、外れ値を多く選んでしまい、元のデータとは分布状況が異なってしまい、解析結果がおかしくなる可能性がある。
<Outlier>
When performing random sampling, many outliers are selected, and the distribution status differs from the original data, which may cause the analysis result to be strange.
図2は、ランダムサンプリングに伴う外れ値を説明する図である。図2に示すように、外れ値を多くサンプリングすると、実データとは分布状況大きく異なってしまう場合がある。そこで、1次元データの構造をある程度維持して、外れ値を除外した部分を取得することが重要となる。 FIG. 2 is a diagram for explaining outliers associated with random sampling. As shown in FIG. 2, when many outliers are sampled, there are cases where the distribution situation differs greatly from the actual data. Therefore, it is important to obtain a portion excluding outliers while maintaining the structure of the one-dimensional data to some extent.
本実施形態においては、B-Tree インデックスを使用して、他の点(レコード)間の距離に比べ、点(レコード)間の距離が離れている1次元のデータ(レコード)を外れ値とするもので、疎密度(後述する)の値が大きいリーフブロックをサンプリング対象から除外するものである。 In this embodiment, by using the B-Tree index, one-dimensional data (record) in which the distance between points (records) is larger than the distance between other points (records) is used as an outlier. Therefore, leaf blocks having a large value of sparse density (described later) are excluded from sampling targets.
図3は、除外するリーフブロックを説明する図である。ルートノードでは、Key値と下層のブランチノードへのポインタを管理している。Key値が指定された場合に、次にどのブランチノードに進めばよいかがわかる。ブランチノードでは、Key値を更に細かく分割するとともに下層のリーフノードへのポインタを管理している。リーフノードは、最下層のノードであり、Key値とKey値に対応するレコードが記憶されているレコード記憶領域の物理的な位置を管理している。 FIG. 3 is a diagram for explaining leaf blocks to be excluded. The root node manages the Key value and the pointer to the lower branch node. When the Key value is specified, it is understood which branch node should be advanced next. In the branch node, the Key value is further divided and the pointer to the leaf node in the lower layer is managed. The leaf node is the lowest layer node and manages the physical position of the record storage area in which the key value and the record corresponding to the key value are stored.
図3に示す例では、 ルートノードは、Key値=61であり、Key値が29である左側のブランチノードと、Key値が81である右側のブランチノードへのポインタを管理している。検索Key値が61よりも小さい場合には、左側のブランチノードに分岐し、検索Key値が61よりも大きい場合には、右側のブランチノードに分岐する。Key値=29の左側のブランチノードでは、Key値が3乃至8である左側のリーフノードと、Key値が52乃至57である右側のリーフノードへのポインタを管理している。
In the example shown in FIG. 3, the root node manages a pointer to the left branch node whose Key value is 61 and the Key value is 29, and the right branch node whose Key value is 81. If the search key value is smaller than 61, the process branches to the left branch node. If the search key value is greater than 61, the process branches to the right branch node. The left branch node with Key value = 29 manages pointers to the left leaf node with
検索Key値が29よりも小さい場合には、左側のリーフノードに分岐し、検索Key値が29よりも大きい場合には、右側のリーフノードに分岐する。図3に示す最左側のリーフノードでは、検索Key値が3以下の場合のレコード数、検索Key値が3と8の間にある場合のレコード数、検索Key値が8以上の場合のレコード数が管理されている。他のリーフノードでも同様である。リーフノードには、Key値と当該Keyに対応するレコードへのアドレスの組から成るリーフブロックがつながっている。 If the search key value is smaller than 29, the process branches to the left leaf node. If the search key value is greater than 29, the process branches to the right leaf node. In the leftmost leaf node shown in FIG. 3, the number of records when the search key value is 3 or less, the number of records when the search key value is between 3 and 8, and the number of records when the search key value is 8 or more. Is managed. The same applies to other leaf nodes. The leaf node is connected to a leaf block including a pair of a key value and an address to a record corresponding to the key.
本実施形態では、リーフブロックの点間の平均距離が他のリーフブロックよりも大きければ外れ値を含む可能性が高いため、除外する。図3に示す例では、Key値が8以上の場合のリーフブロックの範囲は、他のリーフブロックの範囲に比べ大きいので、外れ値を含む可能性があり、除外対象とする。したがって、Key値が8以上の場合のリーフブロックからは、レコードを取得しないことになる。 In the present embodiment, if the average distance between the points of the leaf block is larger than that of the other leaf blocks, it is highly likely that an outlier is included, and therefore it is excluded. In the example illustrated in FIG. 3, the range of leaf blocks when the Key value is 8 or more is larger than the range of other leaf blocks, and thus may include outliers and are excluded. Therefore, no record is acquired from the leaf block when the Key value is 8 or more.
<疎密度>
本実施形態においては、「リーフブロック毎のKey間の平均距離」を疎密度と定義する。具体的には、疎密度は、(リーフブロック中のKeyの最大値−リーフブロック中のKeyの最小値)を(リーフブロックのレコード数-1)で除して得られる。尚、リーフブロック中に1レコードしかない場合は、疎密度の判定は行わない。
<Sparse density>
In the present embodiment, “average distance between keys for each leaf block” is defined as sparse density. Specifically, the sparse density is obtained by dividing (the maximum value of the key in the leaf block−the minimum value of the key in the leaf block) by (the number of records in the leaf block−1). Note that if there is only one record in the leaf block, the density determination is not performed.
疎密度の数値自体が小さければ(Key間の平均距離が短い)、疎密度が高くて密であり、疎密度の数値自体が大きければ(Key間の平均距離が長い)、疎密度が低くて疎である。B-Tree はソートされているため疎密度の数値自体が大きいほど、点間の距離が離れている点を含む可能性が高い。 If the sparse density value itself is small (the average distance between keys is short), the sparse density is high and dense, and if the sparse density value itself is large (the average distance between keys is long), the sparse density is low. Sparse. Since the B-Tree is sorted, the larger the sparse density itself, the more likely it is to include points that are more distant from each other.
<リーフブロックの除外の判定>
本実施形態では、他のリーフブロックに比べ、相対的に疎なリーフブロックを除外する。他の点間の距離に比べ、点間の距離が離れている点を除外するには、複数のリーフブロック中から、(Keyの最大値−Keyの最小値)の値が大きいリーフブロックを除外する。
<Determining the exclusion of leaf blocks>
In the present embodiment, leaf blocks that are relatively sparse compared to other leaf blocks are excluded. To exclude points that are far apart from each other compared to the distance between other points, exclude the leaf block that has a large value of (Maximum value of key-Minimum value of key) from multiple leaf blocks. To do.
換言すれば、疎密度の数値自体が大きいものは疎であるのでサンプリング対象とするリーフブロックから除外し、疎密度の数値自体が小さいものは密であるのでサンプリング対象とするリーフブロックから除外しない。 In other words, those having a large sparse density value are sparse and therefore excluded from the leaf block to be sampled, and those having a small sparse density value itself are dense and are not excluded from the leaf block to be sampled.
ユーザーは正規分布上で疎なリーフブロックの上位何%を除外するか、パーセンテージで指定することができる。具体的には、疎密度の全体平均値よりも、ある値以上の疎密度を持つリーフブロックを除外する。 The user can specify what percentage of the top sparse leaf blocks to exclude from the normal distribution as a percentage. Specifically, leaf blocks having a sparse density greater than a certain value are excluded from the overall average value of the sparse density.
例えば、除外判定の閾値は、以下の式で示される。
上記した除外判定の閾値以上の疎密度を持つリーフブロックを、サンプリング対象とするリーフブロックから除外する。係数Qは、ユーザーから指定されるパーセンテージから求め、リーフブロックの疎密度を正規分布と仮定し、既存の手法で計算する。例えば、統計学の「パーセント点」を用いることが好適であり、正規分布において、上側確率が2.5%となるパーセント点は1.96である。 Leaf blocks having a sparse density equal to or greater than the above-described exclusion determination threshold are excluded from the leaf blocks to be sampled. The coefficient Q is obtained from a percentage specified by the user, and is calculated by an existing method assuming that the sparse density of the leaf blocks is a normal distribution. For example, it is preferable to use a statistical “percentage point”, and in the normal distribution, the percentage point at which the upper probability is 2.5% is 1.96.
図4は、正規分布図と除外する割合を説明する図である。図4に示すように、正規分布図の面積が、その範囲内に疎密度が存在するリーフブロックのパーセンテージとなる。図4に示す正規分布図では、中央値となる全体の疎密度の平均値よりも右側にいくほど、疎密度の数値が大きい(Key間の平均距離が長い)ことを示している。疎密度の数値が小さい(Key間の平均距離が短い)場合は、外れ値を含む可能性が低くサンプリング対象から除外する必要がないため、正規分布図の中央値の左側は全て含む。
FIG. 4 is a diagram for explaining the normal distribution chart and the excluded ratio. As shown in FIG. 4, the area of the normal distribution map is the percentage of leaf blocks in which the sparse density exists within the range. The normal distribution diagram shown in FIG. 4 indicates that the numerical value of the sparse density is larger (the average distance between the keys is longer) as it goes to the right of the average value of the overall sparse density that is the median value. When the numerical value of the sparse density is small (the average distance between keys is short), it is unlikely that an outlier is included, and it is not necessary to exclude it from the sampling target.
<疎密度を付加したB-Tree インデックスの構造>
図5は、疎密度を付加したB-Tree インデックスの構造を示した図である。図5に示すように、ルートノードでは、Key値と子ノードのレコード数および下層のブランチノードへのポインタを管理している。Key値が指定された場合に、次にどのブランチノードに進めばよいかがわかる。ブランチノードでは、Key値を更に細かく分割するとともに子ノードのレコード数および下層のリーフノードへのポインタを管理している。リーフノードは、最下層のノードであり、Key値、子ノード(リーフブロック)のレコード数、子ノード(リーフブロック)毎の疎密度およびKey値に対応するレコードが記憶されているレコード記憶領域の物理的な位置を管理している。
<B-Tree index structure with sparse density>
FIG. 5 is a diagram showing the structure of a B-Tree index to which sparse density is added. As shown in FIG. 5, the root node manages the Key value, the number of records of child nodes, and pointers to the lower branch nodes. When the Key value is specified, it is understood which branch node should be advanced next. In the branch node, the Key value is further divided and the number of records of the child node and the pointer to the leaf node in the lower layer are managed. A leaf node is a lowermost node, and is stored in a record storage area in which a key value, the number of records of a child node (leaf block), a sparse density for each child node (leaf block), and a record corresponding to the key value are stored. The physical position is managed.
図5に示す例では、ルートノードのKey値=61であり、左側のブランチノードのレコード数は10個、右側のブランチノードのレコード数は7個で、子ノードのレコード数は合計で17個となっている。検索Key値が61よりも小さい場合には、左側のブランチノードに分岐し、検索Key値が61よりも大きい場合には、右側のブランチノードに分岐する。 In the example shown in FIG. 5, the key value of the root node is 61, the number of records in the left branch node is 10, the number of records in the right branch node is 7, and the number of records in the child nodes is 17 in total. It has become. If the search key value is smaller than 61, the process branches to the left branch node. If the search key value is greater than 61, the process branches to the right branch node.
同様に、左側のブランチノードでは、Key値=29であり、左側のリーフノードのレコード数は6個、右側のリーフノードのレコード数は4個で、子ノードのレコード数は合計で10個となっている。検索Key値が29よりも小さい場合には、左側のリーフノードに分岐し、検索Key値が29よりも大きい場合には、右側のリーフノードに分岐する。図5に示す最左側のリーフノードでは、Key値が3以下の場合の2個のレコード数、Key値が3と8の間にある場合の2個のレコード数、Key値が8以上の場合の2個のレコード数が管理されている。他のリーフノードでも同様である。本実施形態では、Key間の平均距離を表す疎密度がリーフノード毎に管理されている。最左側のリーフノードでは、Key値が3以下の場合の疎密度が2、Key値が3と8の間にある場合の疎密度が3、Key値が8以上の場合の疎密度が20であると管理されている。さらに、リーフノードには、Key値と当該Keyに対応するレコードへのアドレスの組から成るリーフブロックがつながっている。 Similarly, in the left branch node, Key value = 29, the number of records in the left leaf node is 6, the number of records in the right leaf node is 4, and the number of records in the child nodes is 10 in total. It has become. If the search key value is smaller than 29, the process branches to the left leaf node. If the search key value is greater than 29, the process branches to the right leaf node. In the leftmost leaf node shown in FIG. 5, the number of two records when the Key value is 3 or less, the number of two records when the Key value is between 3 and 8, and the Key value is 8 or more These two records are managed. The same applies to other leaf nodes. In this embodiment, the sparse density representing the average distance between keys is managed for each leaf node. In the leftmost leaf node, the sparse density is 2 when the Key value is 3 or less, the sparse density is 3 when the Key value is between 3 and 8, and the sparse density is 20 when the Key value is 8 or more. It is managed to be. Further, a leaf block consisting of a pair of a key value and an address to a record corresponding to the key is connected to the leaf node.
<B-Treeによるランダムサンプリング>
B-Treeでは、ブランチノードの分岐数やリーフブロック中のレコード数が、ツリーによって異なるため、サンプリング時に移動(分岐方向)をランダムにすると、取得されるレコードに偏りが生じる。
<Random sampling with B-Tree>
In B-Tree, the number of branches of branch nodes and the number of records in leaf blocks differ depending on the tree. Therefore, if the movement (branch direction) is random at the time of sampling, the obtained records are biased.
図6は、特定のリーフブロックへのレコードの偏在を説明する図である。尚、図6では、子ノードのレコード数、疎密度は図示していない。図6に示すB-Treeでは、Key値=29の左側ブランチノードにぶら下がるリーフ数が6、右側ブランチノードにぶら下がるリーフ数が4と、リーフノードのレコード数にばらつきがある。そのため、ルートノードからKey値=29の左側ブランチノードを経て、Key値=52乃至57の右側リーフノードへとランダムに移動してレコードを取得していくと、取得されるレコード数に偏りが生じる。 FIG. 6 is a diagram for explaining the uneven distribution of records in a specific leaf block. In FIG. 6, the number of records and sparse density of child nodes are not shown. In the B-Tree shown in FIG. 6, the number of leaves hanging from the left branch node of Key value = 29 is 6 and the number of leaves hanging from the right branch node is 4, so that the number of records of the leaf nodes varies. Therefore, if records are acquired by moving randomly from the root node to the right leaf node of Key value = 52 to 57 via the left branch node of Key value = 29, the number of records to be acquired is biased. .
図7は、選択確率を考慮したB-Treeにおけるランダムサンプリングを説明する図である。尚、図7では、疎密度は図示していない。図7に示すように、ルートノード、ブランチノードで子ノードのレコード数を保持する。すなわち、ブランチノードでは分岐する範囲毎に子ノードのレコード数を保持し、リーフノードでは現在のレコード数を保持し、子ノードへのランダム・ウォークを行うときに、各子ノードへ移動する確率を計算し決定するのが好適である。これにより、各レコードの選択確率を平均化することが可能となる。 FIG. 7 is a diagram for explaining random sampling in the B-Tree in consideration of the selection probability. In FIG. 7, sparse density is not shown. As shown in FIG. 7, the root node and the branch node hold the number of child node records. That is, the branch node holds the number of records of the child node for each branching range, the leaf node holds the current number of records, and the probability of moving to each child node when performing a random walk to the child node It is preferred to calculate and determine. Thereby, it becomes possible to average the selection probability of each record.
<B-Treeの再構築>
図8乃至図12は、B-Treeの更新の手順と再計算の範囲を説明する図である。図8に示すように、疎密度を付加したB-Treeインデックス構造において、Key値=6という挿入レコードを追加する。図9に示すように、移動先の子ノードのレコード数を加算しながら挿入位置を探索していく。まず、ルートノードから、Key値=29の左側ブランチノードに移動する。その結果、ルートノードが保持する子ノードのレコード数は11となる。同様に、ブランチノードでは、左側のリーフノードに移動していくので、ブランチノードが保持する子ノードのレコード数は7となる。挿入レコードは、Key値=6であるので、リーフノードのKey値=3とKey値=8の間に該当するので、中央のブロックに挿入される。その結果、図9に示すように、中央のリーフノードにつながるリーフブロック数は、3個となる。B-treeを再構築する場合の、適切なリーフノードにつながるリーフブロック数は、ユーザーが任意に設定することができる。尚、図9に示す例では、図を見やすくするため、リーフノードにつながるリーフブロックは最大で2個までにする。
<Rebuilding B-Tree>
8 to 12 are diagrams for explaining the B-Tree update procedure and the range of recalculation. As shown in FIG. 8, in the B-Tree index structure to which sparse density is added, an insertion record with a Key value = 6 is added. As shown in FIG. 9, the insertion position is searched while adding the number of records of the child node of the movement destination. First, move from the root node to the left branch node with Key value = 29. As a result, the number of child node records held by the root node is 11. Similarly, since the branch node moves to the left leaf node, the number of child node records held by the branch node is seven. Since the insertion record has a Key value = 6, it falls between the Key value = 3 and the Key value = 8 of the leaf node, and is therefore inserted into the central block. As a result, as shown in FIG. 9, the number of leaf blocks connected to the central leaf node is three. When reconstructing a B-tree, the number of leaf blocks connected to an appropriate leaf node can be arbitrarily set by the user. In the example shown in FIG. 9, the number of leaf blocks connected to leaf nodes is limited to two in order to make the drawing easier to see.
図10に示すように、全てのリーフノードにつながるリーフブロックが2個になるようにリーフノードを細分化すると、最左側のリーフノードにつながる子ノード(リーフブロック)数は4個となる。さらに、リーフノードの状態の変化に伴い疎密度も変化している。B-treeを再構築する場合の、適切な子ノード(リーフブロック)数は、ユーザーが任意に設定することができる。尚、図10に示す例では、図を見やすくするため、リーフノードにつながる子ノード(リーフブロック)数は最大で3個までにする。 As shown in FIG. 10, when a leaf node is subdivided so that there are two leaf blocks connected to all leaf nodes, the number of child nodes (leaf blocks) connected to the leftmost leaf node is four. Furthermore, the sparse density also changes as the state of the leaf node changes. The user can arbitrarily set the appropriate number of child nodes (leaf blocks) when rebuilding the B-tree. In the example shown in FIG. 10, the number of child nodes (leaf blocks) connected to the leaf nodes is limited to three at maximum in order to make the drawing easy to see.
そこで、図11に示すように、Key値=3のリーフノードとKey値=8のリーフノードに分解する。これに伴い、左側のブランチノードもKey値=6と、Key=29の分岐となるように分解する。この場合、ブランチノードの状態が変化したためレコード数を再計算する必要が生じる。 Therefore, as shown in FIG. 11, it is broken down into leaf nodes with Key value = 3 and leaf nodes with Key value = 8. Along with this, the left branch node is also decomposed so as to be a branch of Key value = 6 and Key = 29. In this case, since the state of the branch node has changed, it is necessary to recalculate the number of records.
図12は、レコードの更新による計算が必要となる箇所を説明する図である。本実施形態では、疎密度の再計算が必要な場所は、通常のB-treeの更新部分と同じである。そのため、更新の計算量はlog(n)となる。 FIG. 12 is a diagram for explaining a place where calculation by updating a record is necessary. In this embodiment, the place where the sparse density needs to be recalculated is the same as the normal B-tree update part. Therefore, the update calculation amount is log (n).
<B-Tree構築処理の流れ>
以上のようにして構成されたサンプリング装置1におけるB-Tree構築処理の流れについて説明する。図13は、サンプリング装置1におけるB-Tree構築処理の流れを説明するフローチャートである。
<B-Tree construction process flow>
A flow of B-Tree construction processing in the
まず、カーソルをルートノードへ移動する(ステップS131)。 First, the cursor is moved to the root node (step S131).
次に、挿入するKeyの範囲のノードへカーソルを移動する。移動前に移動先ノードのレコード数を1加算する(ステップS132)。 Next, move the cursor to the node in the range of the key to be inserted. Before the movement, 1 is added to the number of records of the movement destination node (step S132).
続いて、カーソルの位置がリーフノードであるか否かを判定する(ステップS133)。カーソルの位置がリーフノードでなければ(ステップS133でNo)、ステップS132に戻り、カーソルの位置がリーフノードであれば(ステップS133でYes)、Keyとレコードのアドレスをリーフブロックに追加する(ステップS134)。 Subsequently, it is determined whether or not the cursor position is a leaf node (step S133). If the cursor position is not a leaf node (No in step S133), the process returns to step S132, and if the cursor position is a leaf node (Yes in step S133), the key and the address of the record are added to the leaf block (step). S134).
次に、リーフブロックに規定数以上のレコードがあるか否かを判定する(ステップS135)。ここで、規定数は、B-Treeを再構築するか否かの閾値となるものである。特定のリーフブロックに多くのレコードが偏在することを避け、各レコードの選択確率を平均化するために、子ノードのレコード数を管理するのが好適である。 Next, it is determined whether there are more than a predetermined number of records in the leaf block (step S135). Here, the specified number is a threshold value for determining whether or not to reconstruct the B-Tree. It is preferable to manage the number of records of child nodes in order to avoid the uneven distribution of many records in a specific leaf block and to average the selection probability of each record.
リーフブロックに規定数以上のレコードがなければ(ステップS135でNo)、追加を行ったリーフブロックの疎密度を再計算し、リーフノードへ保存(ステップS136)し、B-Tree構築処理を終了する。 If there are no more than the specified number of records in the leaf block (No in step S135), the sparse density of the added leaf block is recalculated, stored in the leaf node (step S136), and the B-Tree construction process is terminated. .
一方、リーフブロックに規定数以上のレコードがあれば(ステップS135でYes)、B-Treeの再構築を実行する(ステップS137)。 On the other hand, if there are more than the specified number of records in the leaf block (Yes in step S135), B-Tree reconstruction is executed (step S137).
続いて、再構築の影響を受けた各リーフブロックの疎密度と、子ノードのレコード数を再計算してリーフノードへ保存(ステップS138)し、B-Tree構築処理を終了する。 Subsequently, the sparse density of each leaf block affected by the reconstruction and the number of records of the child nodes are recalculated and stored in the leaf nodes (step S138), and the B-Tree construction process is terminated.
<ランダムサンプリング処理の流れ>
以上のようにして構成されたサンプリング装置1におけるランダムサンプリング処理の流れについて説明する。図14は、サンプリング装置1におけるランダムサンプリング処理の流れを説明するフローチャートである。
<Random sampling process flow>
A flow of random sampling processing in the
まず、要求変換部12は、レコードのサンプリング数と、リーフブロックの除外判定時に必要な係数Qを、ユーザーが指定した入力から決定する(ステップS1401)。
First, the
次に、データ操作部13は、全てのリーフノードに移動し、全リーフブロックの疎密度の標準偏差σと全リーフブロックの疎密度の平均値を計算する(ステップS1402)。
Next, the
次に、カーソルをルートノードへ移動する(ステップS1403)。 Next, the cursor is moved to the root node (step S1403).
次に、カーソルを子ノードへ移動する(ステップS1404)。 Next, the cursor is moved to the child node (step S1404).
続いて、カーソルの位置がリーフノードであるか否かを判定する(ステップS1405)。 Subsequently, it is determined whether or not the position of the cursor is a leaf node (step S1405).
カーソルの位置がリーフノードでなければ(ステップS1405でNo)、ステップS1404に戻り、カーソルの位置がリーフノードであれば(ステップS1405でYes)、リーフノードにつながっているリーフブロックの1つをランダムに選択する(ステップS1406)。 If the cursor position is not a leaf node (No in step S1405), the process returns to step S1404. If the cursor position is a leaf node (Yes in step S1405), one of the leaf blocks connected to the leaf node is randomly selected. (Step S1406).
次に、選択したリーフブロックの疎密度が、リーフブロックを除外する際の閾値よりも小さいか否かを判定する(ステップS1407)。 Next, it is determined whether or not the sparse density of the selected leaf block is smaller than a threshold value when excluding the leaf block (step S1407).
選択したリーフブロックの疎密度が、リーフブロックを除外する際の閾値よりも小さくなければ(ステップS1407でNo)、当該リーフブロックはサンプリングレコードに適さないので除外し、ステップS1403に移行する。 If the sparse density of the selected leaf block is not smaller than the threshold value when excluding the leaf block (No in step S1407), the leaf block is excluded because it is not suitable for the sampling record, and the process proceeds to step S1403.
一方、選択したリーフブロックの疎密度が、リーフブロックを除外する際の閾値よりも小さければ(ステップS1407でYes)、選択したリーフブロックから取得するレコードをランダムに1つ決定し結果セットへ挿入する(ステップS1408)。 On the other hand, if the sparse density of the selected leaf block is smaller than the threshold for excluding the leaf block (Yes in step S1407), one record to be acquired from the selected leaf block is randomly determined and inserted into the result set. (Step S1408).
次に、結果セットに取得したレコードの総数が指定されたサンプリング数に達しているか否かを判定する(ステップS1409)。 Next, it is determined whether or not the total number of records acquired in the result set has reached the designated sampling number (step S1409).
指定されたサンプリング数に達していなければ(ステップS1409でNo)、引き続きランダムサンプリングを実行するためにステップS1403に移行する。 If the specified number of samplings has not been reached (No in step S1409), the process proceeds to step S1403 to continue random sampling.
一方、指定されたサンプリング数に達していれば(ステップS1409でYes)、結果セットをアプリケーションへ返して(ステップS1410)、ランダムサンプリング処理を終了する。 On the other hand, if the designated sampling number has been reached (Yes in step S1409), the result set is returned to the application (step S1410), and the random sampling process is terminated.
[実施例]
次に、本実施形態の実施例について説明する。ここでは、図5に示すB-treeインデックス構造において、ランダムサンプリングを実行する実施例について説明する。図15は、実施例におけるサンプリング要求に対する処理を説明する図である。
[Example]
Next, examples of the present embodiment will be described. Here, an embodiment in which random sampling is executed in the B-tree index structure shown in FIG. 5 will be described. FIG. 15 is a diagram illustrating processing for a sampling request in the embodiment.
アプリケーション11は、ユーザーによるデータベースからランダムサンプリングを実行するとのクエリに対応して、要求変換部12に対して図15に示すようなサンプリング要求が行われた。ここでは、“TEST”と名付けられた対象レコード記憶領域に対して、サンプリングするレコードの数を指定レコード記憶領域の10%と指定され、除外するリーフブロックの割合が5%と指定されている。
The
ルートノード(Key値=61)の子ノードのレコード数は10+7=17なので、サンプリングレコード数を17×0.1 ≒ 2レコードと決定する。
Since the number of records of the child node of the root node (Key value = 61) is 10 + 7 = 17, the number of sampling records is determined to be 17 × 0.1≈2 records.
図16は、実施例における疎密度の標準偏差の計算を説明する図である。図16に示すように、全てのリーフノードに移動して疎密度を取得する。取得した疎密度に基づき疎密度の標準偏差と平均値を計算する。実施例では、リーフブロックの除外判定の閾値は、6.0+1.6×6.0=15.6となる。 FIG. 16 is a diagram for explaining calculation of the standard deviation of sparse density in the embodiment. As shown in FIG. 16, the sparse density is acquired by moving to all leaf nodes. Based on the acquired sparse density, the standard deviation and average value of the sparse density are calculated. In the embodiment, the threshold for leaf block exclusion determination is 6.0 + 1.6 × 6.0 = 15.6.
図17は、実施例におけるサンプリングレコードの決定を説明する図である。図17に示すように、除外判定の閾値と疎密度を比較する。実施例では、リーフブロックの除外判定の閾値が15.6であるため、レコードを1つランダムで選択する。取得したレコード総数が、サンプリング数として指定された数でなければルートノードに移動する。 FIG. 17 is a diagram illustrating determination of sampling records in the embodiment. As shown in FIG. 17, the threshold value for exclusion determination is compared with the sparse density. In the embodiment, since the threshold for leaf block exclusion determination is 15.6, one record is selected at random. If the total number of records acquired is not the number specified as the sampling number, the process moves to the root node.
図18は、実施例におけるサンプリングレコードの決定およびリーフブロックの除外を説明する図である。図18に示すように、リーフブロックの除外判定の閾値が15.6であるのに対し 、選択したリーフブロックの疎密度が20であるため、除外するリーフブロックと判断する。そこで、当該リーフブロックにつながるレコードは、サンプリングレコードとはせずに、ルートノードに移動する。 FIG. 18 is a diagram for explaining sampling record determination and leaf block exclusion in the embodiment. As shown in FIG. 18, the leaf block exclusion determination threshold is 15.6, whereas the selected leaf block has a sparse density of 20. Therefore, it is determined as a leaf block to be excluded. Therefore, the record connected to the leaf block does not become a sampling record but moves to the root node.
以上を、取得したレコード総数が、サンプリング数として指定された数に到達するまで繰り返す。 The above is repeated until the total number of acquired records reaches the number specified as the sampling number.
本実施形態によれば、ランダムサンプリングの実行に際して、レコード数をnとすると、厳密にKeyの外れ値を計算する場合と比べて計算量を1/nに少なくすることができる。 According to the present embodiment, when executing random sampling, if the number of records is n, the amount of calculation can be reduced to 1 / n compared to the case of strictly calculating an outlier value of Key.
本発明のいくつかの実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。これら新規な実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更を行うことができる。これら実施形態やその変形は、発明の範囲や要旨に含まれるとともに、特許請求の範囲に記載された発明とその均等の範囲に含まれる。 Although several embodiments of the present invention have been described, these embodiments are presented by way of example and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other forms, and various omissions, replacements, and changes can be made without departing from the scope of the invention. These embodiments and modifications thereof are included in the scope and gist of the invention, and are included in the invention described in the claims and the equivalents thereof.
1・・・サンプリング装置
11・・・アプリケーション
12・・・要求変換部
13・・・データ操作部
14・・・レコード記憶部
15・・・B-tree インデックス記憶部
DESCRIPTION OF
Claims (12)
階層構造を成すとともに、索引情報をインデックスとして保持するB-Tree インデックスに加えて、前記レコード記憶部に記憶されるレコードに応じた、リーフブロック毎のKey 間の平均距離で表す疎密度と、全リーフブロックの前記疎密度の平均値と、全リーフブロックの前記疎密度の標準偏差と、子ノードのレコード数の付加情報を記憶するB-Tree インデックス記憶部と、
ユーザーによる前記データベースからのランダムサンプリングを実行するとのクエリに対応して、サンプリング要求を行うアプリケーションと、
前記アプリケーションからサンプリング要求を受け取り、サンプリング命令に変換する要求変換部と、
前記要求変換部から受け取ったサンプリング命令を解釈してサンプリングレコードを決定し、前記レコード記憶部からサンプリングレコードを取得する場合、前記全リーフブロックの前記疎密度の平均値よりも値の大きな所定値以上の前記疎密度を持つリーフブロックは外れ値を含むとみなして除外し、除外されなかったリーフブロックからレコードを取得するデータ操作部とを、
備えるサンプリング装置。 A record storage unit for storing a plurality of records constituting the database;
In addition to the B-Tree index, which has a hierarchical structure and holds index information as an index, the sparse density represented by the average distance between keys for each leaf block according to the record stored in the record storage unit, and the total density An average value of the sparse density of leaf blocks, a standard deviation of the sparse density of all leaf blocks, and a B-Tree index storage unit that stores additional information on the number of records of child nodes;
An application that makes a sampling request in response to a query by a user to perform random sampling from the database;
A request conversion unit that receives a sampling request from the application and converts it into a sampling instruction;
When determining the sampling record by interpreting the sampling instruction received from the request conversion unit and obtaining the sampling record from the record storage unit, the predetermined value is greater than the average value of the sparse density of all the leaf blocks A data manipulation unit that obtains a record from a leaf block that is not excluded, excluding a leaf block having the sparse density of
A sampling device provided.
ユーザーによる前記データベースからのランダムサンプリングを実行するとのクエリに対応して、サンプリング要求を行う機能と、
前記サンプリング要求をサンプリング命令に変換する機能と、
前記サンプリング命令を解釈してサンプリングレコードを決定し、サンプリングレコードを取得する場合、前記全リーフブロックの前記疎密度の平均値よりも値の大きな所定値以上の前記疎密度を持つリーフブロックは外れ値を含むとみなして除外し、除外されなかったリーフブロックからレコードを取得する機能と、
を実現させるためのサンプリングプログラム。 In addition to a record storage unit that stores a plurality of records that constitute a database, and a B-Tree index that has a hierarchical structure and holds index information as an index, a leaf corresponding to a record stored in the record storage unit B that stores additional information such as the sparse density expressed by the average distance between keys for each block, the average value of the sparse density of all leaf blocks, the standard deviation of the sparse density of all leaf blocks, and the number of records of child nodes -Sampling device equipped with an index storage unit,
In response to a query to perform random sampling from the database by the user, a function to make a sampling request;
A function of converting the sampling request into a sampling instruction;
When interpreting the sampling instruction to determine a sampling record and obtaining a sampling record, a leaf block having a sparse density greater than or equal to a predetermined value greater than the average value of the sparse density of all the leaf blocks is an outlier. With the ability to retrieve records from leaf blocks that were not included and excluded
Sampling program to realize.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015015094A JP6411232B2 (en) | 2015-01-29 | 2015-01-29 | Sampling apparatus and sampling program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015015094A JP6411232B2 (en) | 2015-01-29 | 2015-01-29 | Sampling apparatus and sampling program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2016139361A JP2016139361A (en) | 2016-08-04 |
JP6411232B2 true JP6411232B2 (en) | 2018-10-24 |
Family
ID=56560254
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2015015094A Active JP6411232B2 (en) | 2015-01-29 | 2015-01-29 | Sampling apparatus and sampling program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6411232B2 (en) |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02183867A (en) * | 1989-01-11 | 1990-07-18 | Nec Corp | Table retrieving method |
JPH0496837A (en) * | 1990-08-14 | 1992-03-30 | Nippon Telegr & Teleph Corp <Ntt> | Index constituting method for data base processing device |
JP3651550B2 (en) * | 1998-02-23 | 2005-05-25 | 三菱電機株式会社 | Attribute compression apparatus and method |
JP5655764B2 (en) * | 2011-11-09 | 2015-01-21 | トヨタ自動車株式会社 | Sampling apparatus, sampling program, and method thereof |
US9189518B2 (en) * | 2012-10-19 | 2015-11-17 | International Business Machines Corporation | Gathering index statistics using sampling |
-
2015
- 2015-01-29 JP JP2015015094A patent/JP6411232B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2016139361A (en) | 2016-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI682285B (en) | Product, method, and machine readable medium for kvs tree database | |
JP4878178B2 (en) | Data processing method and apparatus, and processing program therefor | |
CN110291518A (en) | Merge tree garbage index | |
CN110383261A (en) | Stream for multithread storage device selects | |
CN102693266B (en) | Search for method, the navigation equipment and method of generation index structure of database | |
CN110268399A (en) | Merging tree for attended operation is modified | |
CN106503223B (en) | online house source searching method and device combining position and keyword information | |
CN113434623B (en) | Fusion method based on multi-source heterogeneous space planning data | |
US10042914B2 (en) | Database index for constructing large scale data level of details | |
CN109033314B (en) | Real-time query method and system for large-scale knowledge graph under condition of limited memory | |
JP6862531B2 (en) | Guided data exploration | |
CN103970902A (en) | Method and system for reliable and instant retrieval on situation of large quantities of data | |
US9047363B2 (en) | Text indexing for updateable tokenized text | |
CN111026865A (en) | Relation alignment method, device and equipment of knowledge graph and storage medium | |
US9996535B1 (en) | Efficient hierarchical user interface | |
CN110795397B (en) | Automatic identification method for catalogue and file type of geological data packet | |
CN112817530A (en) | Method for safely and efficiently reading and writing ordered data in multithreading manner | |
JP6411232B2 (en) | Sampling apparatus and sampling program | |
US10394870B2 (en) | Search method | |
JP6904724B2 (en) | Map database creation device, map database creation method, and map database creation program | |
Vespa et al. | Efficient bulk-loading on dynamic metric access methods | |
KR102354343B1 (en) | Spatial indexing method and apparatus for blockchain-based geospatial data | |
KR20220099745A (en) | A spatial decomposition-based tree indexing and query processing methods and apparatus for geospatial blockchain data retrieval | |
Kaporis et al. | ISB-tree: A new indexing scheme with efficient expected behaviour | |
JP2020135530A (en) | Data management device, data search method and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20171010 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20180817 |
|
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: 20180828 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180926 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 6411232 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |