JP2012133608A - Histogram generation device, method and program - Google Patents

Histogram generation device, method and program Download PDF

Info

Publication number
JP2012133608A
JP2012133608A JP2010285325A JP2010285325A JP2012133608A JP 2012133608 A JP2012133608 A JP 2012133608A JP 2010285325 A JP2010285325 A JP 2010285325A JP 2010285325 A JP2010285325 A JP 2010285325A JP 2012133608 A JP2012133608 A JP 2012133608A
Authority
JP
Japan
Prior art keywords
histogram
division candidate
division
candidate points
change value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2010285325A
Other languages
Japanese (ja)
Inventor
Koji Tamano
浩嗣 玉野
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP2010285325A priority Critical patent/JP2012133608A/en
Publication of JP2012133608A publication Critical patent/JP2012133608A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To provide technique for generating a histogram with high speed.SOLUTION: A histogram generation device includes: determination means for, on the basis of object data for generating a histogram, determining a plurality of division candidate points that are to be candidates for division points to determine respective segments of a histogram; change value calculation means for respectively calculating change values of frequency of the object data at the respective division candidate points; selection means for selecting fewer numbers of division candidate points than the number of division candidate points determined by the determination means by sampling the plurality of division candidate points on the basis of the respective change values calculated by the change value calculation means; and histogram generation means for generating a histogram of the object data by using the division candidate points selected by the selection means.

Description

本発明は、ヒストグラム生成技術に関する。   The present invention relates to a histogram generation technique.

ヒストグラムは、縦軸に頻度(度数)、横軸に階級を持つ統計グラフの一種であり、データの分布状況を表現する。与えられたデータに関し生成されるヒストグラムにより、データの分布が視覚的に把握される。ヒストグラムは、このような点に加えて、産業上の様々な技術に応用される。   A histogram is a kind of statistical graph having a frequency (frequency) on the vertical axis and a class on the horizontal axis, and expresses the distribution of data. The distribution of data is visually grasped by a histogram generated with respect to given data. In addition to these points, the histogram is applied to various industrial techniques.

ヒストグラムの応用事例の一つとして、データベースのクエリ最適化が挙げられる。クエリ最適化では、クエリを実行するための複数のクエリプランの中から最も効率のよいクエリプランが選択される。クエリ最適化処理では、クエリは複数の小さなサブクエリに分解され、それらの適用順序によりいくつかの実行プランが生成される。   One application of histograms is database query optimization. In query optimization, the most efficient query plan is selected from a plurality of query plans for executing a query. In the query optimization process, a query is decomposed into a plurality of small sub-queries, and some execution plans are generated according to their application order.

データベースは、統計情報としてデータの属性の値に対応する頻度(データ数)のヒストグラムを保持しているため、実際にクエリを実行しなくてもそれぞれのサブクエリの結果の件数はヒストグラムから推定することができる。そのため、クエリ最適化処理では、この推定値を用いてそれぞれの実行プランの計算コストが見積られ、最もコストの低いものが最適な実行プランとして選択される。   Since the database maintains a histogram of the frequency (number of data) corresponding to the attribute value of the data as statistical information, the number of results of each subquery should be estimated from the histogram without actually executing the query Can do. Therefore, in the query optimization process, the calculation cost of each execution plan is estimated using this estimated value, and the one with the lowest cost is selected as the optimal execution plan.

このようなデータベースのクエリ最適化の例では、ヒストグラムの精度が実行プランの良し悪しを決める。例えば、ヒストグラムの精度が悪い場合、適切な実行プランが選ばれず、結果として、クエリの処理に、本来の時間よりも長い時間が費やされる可能性がある。そのため、精度の高いヒストグラムを生成することは、高速にクエリを処理するために重要である。   In such an example of database query optimization, the accuracy of the histogram determines whether the execution plan is good or bad. For example, when the accuracy of the histogram is poor, an appropriate execution plan is not selected, and as a result, a longer time than the original time may be spent processing the query. Therefore, generating a highly accurate histogram is important for processing a query at high speed.

このようなヒストグラムを生成する手法としては、パーティションルールに基づく方法(非特許文献1参照)、MDL(Minimum Description Length)原理に基づくモデル選択により生成する方法(非特許文献2及び3参照)等が存在する。   As a method for generating such a histogram, there are a method based on a partition rule (see Non-Patent Document 1), a method based on model selection based on an MDL (Minimum Description Length) principle (see Non-Patent Documents 2 and 3), and the like. Exists.

前者は、パーティションルールに従ってデータをユーザが所望するビン数に分割する。ここで、ビンとは、ヒストグラムにおける、値を持つ集合が区切られる任意の各区間を意味する。   The former divides data into the number of bins desired by the user according to the partition rule. Here, the bin means an arbitrary section in which a set having values in the histogram is divided.

非特許文献1で示されるように、当該パーティションルールとして、複数のルールが提案されている。例えば、EQUI−WIDTH、EQUI−DEPTH、MAX−DIFF、COMPRESSED等のルールがある。EQUI−WIDTHの手法は、データの値の範囲を均一に分割してヒストグラムを生成する。EQUI−DEPTHの手法は、値の頻度がそれぞれのビンで等しくなるようにヒストグラムを生成する。MAX−DIFFの手法は、連続するユニークなデータ値の頻度の差が大きい場所から順に分割する。COMPRESSEDの手法は、頻度の高い値に個別のビンを与えて、残りはEQUI−WIDTHやEQUI−DEPTHの手法を使う。但し、これらいずれのパーティションルールにおいても、ユーザは、ビン数を指定する必要がある。   As shown in Non-Patent Document 1, a plurality of rules have been proposed as the partition rule. For example, there are rules such as EQUI-WIDTH, EQI-DEPTH, MAX-DIFF, COMPRESED. The EQUI-WIDTH method generates a histogram by uniformly dividing a range of data values. The EQUI-DEPTH method generates a histogram so that the frequency of values is equal in each bin. The MAX-DIFF method divides in order from the place where the frequency difference between consecutive unique data values is large. The COMPRESSED method gives individual bins to frequently used values, and uses the EQUI-WIDTH and EQUI-DEPTH methods for the rest. However, in any of these partition rules, the user needs to specify the number of bins.

一方、後者は、データからそのデータを発生させている確率密度分布の推定を行うことでヒストグラムの生成を行う。そのなかで、MDL原理によりモデル選択を行い、最もデータをよく表現する複雑さのモデルが選択される。このため、後者は、前者のようにユーザがビン数を指定しなくても自動的に適切なビン数を選択することができる。   On the other hand, the latter generates a histogram by estimating the probability density distribution generating the data from the data. Among them, model selection is performed according to the MDL principle, and a model having a complexity that best represents data is selected. For this reason, the latter can automatically select an appropriate number of bins even if the user does not specify the number of bins like the former.

Viswanath Poosala; Yannis E. Ioannidis; Peter J. Haas; Eugene J. Shekita, "Improved Histograms for Selectivity Estimation of Range Predicates", the 1996 ACM SIGMOD international conferenceViswanath Poosala; Yannis E. Ioannidis; Peter J. Haas; Eugene J. Shekita, "Improved Histograms for Selectivity Estimation of Range Predicates", the 1996 ACM SIGMOD international conference Petri Kontkanen; Petri Myllymaki, "MDL Histogram Density Estimation", Eleventh International Conference on Artificial Intelligence and Statistics (AISTATS 2007), 21-24 Mar 2007Petri Kontkanen; Petri Myllymaki, "MDL Histogram Density Estimation", Eleventh International Conference on Artificial Intelligence and Statistics (AISTATS 2007), 21-24 Mar 2007 Rissanen J; Speed T.P; Yu B, "Density estimation by stochastic complexity", IEEE Transactions on Information Theory, Vol.38, March 1992.Rissanen J; Speed T.P; Yu B, "Density estimation by stochastic complexity", IEEE Transactions on Information Theory, Vol. 38, March 1992.

しかしながら、上述のようなモデル選択に基づくヒストグラム生成手法では、パーティションルールに基づく方法に比べて計算量が大きくなる。これは、各ビン数についての、全てのビンの分割の仕方に対してそれぞれ分割の良し悪しを測るための記述長の計算を行うからである。   However, the histogram generation method based on model selection as described above requires a large amount of calculation compared to the method based on the partition rule. This is because, for each bin number, a description length is calculated for measuring the quality of the division for all the bins.

通常、複数の分割候補点から分割点を選ぶ各選択パターンの数分の計算が必要となる。上述の提案手法では、動的プログラミングによりこの計算量の削減が行われている。しかしながら、そのような提案手法であっても、依然として分割候補点の数が大きくなるにつれ計算量は大きくなる。   Usually, it is necessary to calculate the number of selection patterns for selecting a division point from a plurality of division candidate points. In the proposed method described above, the amount of calculation is reduced by dynamic programming. However, even with such a proposed method, the amount of calculation still increases as the number of candidate division points increases.

本発明の目的は、ヒストグラムを高速に生成する技術を提供することにある。   An object of the present invention is to provide a technique for generating a histogram at high speed.

本発明の各態様では、上述した課題を解決するために、それぞれ以下の構成を採用する。   Each aspect of the present invention employs the following configurations in order to solve the above-described problems.

第1の態様は、ヒストグラム生成装置に関する。第1の態様に係るヒストグラム生成装置は、ヒストグラム生成のための対象データに基づいて、ヒストグラムの各区間を決めるための分割点の候補となる複数の分割候補点を決定する決定手段と、当該各分割候補点における上記対象データの頻度の変化値をそれぞれ計算する変化値計算手段と、この変化値計算手段で計算された各変化値に基づいて上記複数の分割候補点をサンプリングすることにより、上記決定手段により決定された分割候補点の数よりも少ない数の分割候補点を選択する選択手段と、この選択手段により選択された分割候補点を用いて上記対象データのヒストグラムを生成するヒストグラム生成手段と、を備える。   A 1st aspect is related with a histogram production | generation apparatus. A histogram generation device according to a first aspect includes: a determination unit that determines a plurality of division candidate points that are candidates for division points for determining each section of a histogram based on target data for generating a histogram; The change value calculation means for calculating the change value of the frequency of the target data at the division candidate points, and sampling the plurality of division candidate points based on the change values calculated by the change value calculation means, Selection means for selecting a smaller number of division candidate points than the number of division candidate points determined by the determination means, and histogram generation means for generating a histogram of the target data using the division candidate points selected by the selection means And comprising.

第2の態様は、ヒストグラム生成方法に関する。第2の態様に係るヒストグラム生成方法は、コンピュータが、ヒストグラム生成のための対象データに基づいて、ヒストグラムの各区間を決めるための分割点の候補となる複数の分割候補点を決定し、上記各分割候補点における上記対象データの頻度の変化値をそれぞれ計算し、この計算された各変化値に基づいて上記複数の分割候補点をサンプリングすることにより、上記決定された分割候補点の数よりも少ない数の分割候補点を選択し、この選択された分割候補点を用いて上記対象データのヒストグラムを生成する。   The second aspect relates to a histogram generation method. In the histogram generation method according to the second aspect, the computer determines a plurality of division candidate points that are candidates for division points for determining each section of the histogram based on the target data for generating the histogram. By calculating the change value of the frequency of the target data at the division candidate points, and sampling the plurality of division candidate points based on the calculated change values, the number of division candidate points determined above is determined. A small number of division candidate points are selected, and a histogram of the target data is generated using the selected division candidate points.

なお、他の態様として、以上の何れかの構成をコンピュータに実現させるヒストグラム生成プログラムであってもよいし、このようなプログラムを記録したコンピュータが読み取り可能な記憶媒体であってもよい。   As another aspect, a histogram generation program that causes a computer to realize any of the above-described configurations may be used, or a computer-readable storage medium that records such a program may be used.

上記各態様によれば、ヒストグラムを高速に生成する技術を提供することができる。   According to each aspect described above, a technique for generating a histogram at high speed can be provided.

第1実施形態における関係データベースシステムの構成例を示す概念図。The conceptual diagram which shows the structural example of the relational database system in 1st Embodiment. データ格納部の一例としての購買テーブルを示す図。The figure which shows the purchase table as an example of a data storage part. データ格納部の一例としての商品テーブルを示す図。The figure which shows the goods table as an example of a data storage part. ヒストグラムの例を示す図。The figure which shows the example of a histogram. ヒストグラム格納テーブルの例を示す図。The figure which shows the example of a histogram storage table. 第1実施形態における関係データベースシステムのヒストグラム生成時の動作例を示すフローチャート。The flowchart which shows the operation example at the time of the histogram generation of the relational database system in 1st Embodiment. 分割候補点の変化値の計算方法の例を概念的に示す図。The figure which shows notionally the example of the calculation method of the change value of a division | segmentation candidate point. 分割候補点に対する変化値の算出例を概念的に示す図。The figure which shows notionally the example of calculation of the change value with respect to a division | segmentation candidate point. 実行プランの例を示す図。The figure which shows the example of an execution plan. 実行プランの例を示す図。The figure which shows the example of an execution plan. ヒストグラム格納テーブルの第2例を示す図。The figure which shows the 2nd example of a histogram storage table. データ問合せ処理の結果、抽出されたレコードの例を示す図。The figure which shows the example of the record extracted as a result of the data inquiry process. 第2実施形態における関係データベースシステムの構成例を示す概念図。The conceptual diagram which shows the structural example of the relational database system in 2nd Embodiment. 処理時間格納部に格納される処理時間データの例を示す図。The figure which shows the example of the processing time data stored in a processing time storage part. 第2実施形態におけるDBシステムのヒストグラム生成時の動作例を示すフローチャート。The flowchart which shows the operation example at the time of the histogram production | generation of DB system in 2nd Embodiment.

以下、本発明の実施の形態について説明する。なお、以下に挙げる実施形態は例示であり、本発明は以下の実施形態の構成に限定されない。   Embodiments of the present invention will be described below. In addition, embodiment mentioned below is an illustration and this invention is not limited to the structure of the following embodiment.

本実施形態に係るヒストグラム生成装置は、ヒストグラム生成のための対象データに基づいて、該ヒストグラムの各区間を決めるための分割点の候補となる複数の分割候補点を決定する決定部と、当該各分割候補点における対象データの頻度の変化値をそれぞれ計算する変化値計算部と、この変化値計算部で計算された各変化値に基づいて上記複数の分割候補点をサンプリングすることにより、上記決定部により決定された分割候補点の数よりも少ない数の分割候補点を選択する選択部と、この選択部により選択された分割候補点を用いて対象データのヒストグラムを生成する生成部と、を備える。   The histogram generation device according to the present embodiment includes a determination unit that determines a plurality of division candidate points that are candidates for division points for determining each section of the histogram, based on target data for generating a histogram, The change value calculation unit that calculates the change value of the frequency of the target data at each division candidate point, and the determination by sampling the plurality of division candidate points based on each change value calculated by the change value calculation unit A selection unit that selects a smaller number of division candidate points than the number of division candidate points determined by the unit, and a generation unit that generates a histogram of target data using the division candidate points selected by the selection unit. Prepare.

上記ヒストグラム生成装置では、ヒストグラムの各区間を決めるための各分割候補点において、対象データの頻度の変化値がそれぞれ計算され、この変化値に基づいて複数の分割候補点がサンプリングされ絞られた分割候補点が利用されることで対象データのヒストグラムが生成される。つまり、最終的にヒストグラムが生成される際に利用される分割候補点は、対象データに基づいて決められた分割候補点の数よりも少ない数に設定される。   In the histogram generation device, a change value of the frequency of the target data is calculated at each division candidate point for determining each section of the histogram, and a plurality of division candidate points are sampled and narrowed based on the change value. A histogram of the target data is generated by using the candidate points. That is, the candidate division points used when the histogram is finally generated are set to a number smaller than the number of candidate division points determined based on the target data.

従って、上記ヒストグラム生成装置によれば、計算量が分割候補点の数に依存して大きくなるモデル選択に基づくヒストグラム生成方法等が採られた場合であっても、高速にヒストグラムを生成することができる。   Therefore, according to the above-described histogram generation device, a histogram can be generated at high speed even when a histogram generation method or the like based on model selection in which the amount of calculation increases depending on the number of candidate division points is adopted. it can.

以下、上述の実施形態について更に詳細を説明する。以下の各実施形態は、上述のヒストグラム生成装置の構成を関係データベースシステムに適用した場合の例である。なお、上述のヒストグラム生成装置の構成は、関係データベースシステムへの適用に限定されるものではなく、ヒストグラムを生成する様々な態様に適用可能である。例えば、分散データベースシステムに当該ヒストグラム生成装置の構成を適用することが可能である。このシステムでは、各データベース間でのデータ負荷の均一化を図るために、データの分布に基づいて負荷が均一化される。そのデータの分布の予測に利用されるヒストグラムの生成を当該ヒストグラム生成装置の構成で実現してもよい。   Hereinafter, the details of the above-described embodiment will be described. Each of the following embodiments is an example when the configuration of the above-described histogram generation device is applied to a relational database system. The configuration of the above-described histogram generation device is not limited to application to the relational database system, and can be applied to various modes for generating a histogram. For example, the configuration of the histogram generation device can be applied to a distributed database system. In this system, in order to make the data load uniform among the databases, the load is made uniform based on the distribution of data. Generation of a histogram used for predicting the distribution of the data may be realized by the configuration of the histogram generation apparatus.

[第1実施形態]
〔システム構成〕
図1は、第1実施形態における関係データベースシステム(以降、単にDBシステムと表記する)10の構成例を示す概念図である。第1実施形態におけるDBシステム10は、データ格納部100、ヒストグラム生成系200、パラメータ指定部300、ヒストグラム格納部400、データ問合せ部500等を有する。
[First Embodiment]
〔System configuration〕
FIG. 1 is a conceptual diagram showing a configuration example of a relational database system (hereinafter simply referred to as a DB system) 10 in the first embodiment. The DB system 10 in the first embodiment includes a data storage unit 100, a histogram generation system 200, a parameter designation unit 300, a histogram storage unit 400, a data inquiry unit 500, and the like.

DBシステム10は、例えば、CPU(Central Processing Unit)、メモリ(RAM(Random Access Memory)、ROM(Read Only Memory)等)、入出力インタフェース等を有し、CPUによりメモリに記憶されるプログラムが実行されることで上記各処理部を実現する。データ格納部100及びヒストグラム格納部400は、メモリ上で実現される。なお、本実施形態は、DBシステム10のハードウェア構成を限定しない。   The DB system 10 has, for example, a CPU (Central Processing Unit), a memory (RAM (Random Access Memory), a ROM (Read Only Memory), etc.), an input / output interface, etc., and a program stored in the memory is executed by the CPU. As a result, the above-described processing units are realized. The data storage unit 100 and the histogram storage unit 400 are realized on a memory. Note that this embodiment does not limit the hardware configuration of the DB system 10.

データ格納部100は、任意のデータを格納する関係データベースである。図2及び図3は、データ格納部100の例を示す図である。図2には、購入者による商品購入の履歴を格納する購買テーブル(購買T)が示されている。購買テーブルの各レコードには、購入された商品を特定するための商品ID、購入者を特定するための購入者ID、購入時を特定するための日時情報がそれぞれ格納される。   The data storage unit 100 is a relational database that stores arbitrary data. 2 and 3 are diagrams showing examples of the data storage unit 100. FIG. FIG. 2 shows a purchase table (purchase T) for storing a history of product purchase by the purchaser. Each record of the purchase table stores a product ID for specifying the purchased product, a purchaser ID for specifying the purchaser, and date / time information for specifying the purchase time.

図3には、商品情報を格納する商品テーブル(商品T)が示されている。商品テーブルの各レコードには、上記商品ID、商品名、価格がそれぞれ格納される。商品テーブルに格納される商品IDは、購買テーブルに格納される商品IDと対応する。   FIG. 3 shows a product table (product T) for storing product information. Each record of the product table stores the product ID, product name, and price. The product ID stored in the product table corresponds to the product ID stored in the purchase table.

ヒストグラム生成系200は、ヒストグラムを生成する処理系統であり、上述のヒストグラム生成装置の構成に対応する。ヒストグラム生成系200は、分割候補点決定部(以降、単に決定部と表記する)210、変化値計算部220、分割候補点選択部(以降、単に選択部と表記する)230、ヒストグラム生成部240等を含む。ヒストグラム生成系200に含まれるこれら各処理部についても、CPUによりメモリに記憶されるプログラムが実行されることでそれぞれ実現される。   The histogram generation system 200 is a processing system that generates a histogram, and corresponds to the configuration of the above-described histogram generation apparatus. The histogram generation system 200 includes a division candidate point determination unit (hereinafter simply referred to as a determination unit) 210, a change value calculation unit 220, a division candidate point selection unit (hereinafter simply referred to as a selection unit) 230, and a histogram generation unit 240. Etc. Each of these processing units included in the histogram generation system 200 is also realized by executing a program stored in the memory by the CPU.

決定部210は、データ格納部100からヒストグラムを生成したいデータ(対象データ)を取得して、この対象データに基づいて複数の分割候補点を決定する。ここで、分割候補点とは、生成されるヒストグラムのビンとビンとの境界となり得る候補点を意味する。   The determination unit 210 acquires data (target data) for which a histogram is to be generated from the data storage unit 100, and determines a plurality of division candidate points based on the target data. Here, the division candidate point means a candidate point that can be a boundary between bins of a generated histogram.

変化値計算部220は、決定部210により決定された各分割候補点に対し分割され易さを示す値をそれぞれ計算する。本実施形態では、この分割され易さを示す値として、当該各分割候補点における対象データの頻度の変化値をそれぞれ計算する。この変化値は、分割候補点の前後で対象データの頻度がどれくらい急激に変化しているかを示す。ヒストグラムは、長方形(棒グラフ)のビンで密度分布を示すため、ヒストグラムを実際の密度分布に近似させるためには、急激に頻度が変化する部分に分割点を多く置き(ビンを多く割り当て)、変化が小さい部分に分割点を少なく置く又は分割点を置かないことが好ましい。これにより、本実施形態は、分割され易さを分割点での頻度の変化値と捉える。   The change value calculation unit 220 calculates a value indicating the ease of division for each division candidate point determined by the determination unit 210. In the present embodiment, a change value of the frequency of the target data at each division candidate point is calculated as a value indicating the ease of division. This change value indicates how rapidly the frequency of the target data changes before and after the division candidate point. Since the histogram shows the density distribution in rectangular (bar graph) bins, in order to approximate the histogram to the actual density distribution, many dividing points are placed in areas where the frequency changes suddenly (assigning many bins), and the change is made It is preferable to place a small number of dividing points or not to divide the dividing points in a small portion. Thereby, this embodiment regards the easiness of being divided as a change value of the frequency at the dividing point.

変化値計算部220は、当該変化値の計算において、各分割候補点を中心としたデータ精度の範囲のデータを計算対象としてもよい。しかしながら、対象データが少なくデータの抜けが存在するような場合に、分割候補点の近傍のみで変化値を計算すると、そのデータの抜けにより変化値が大きくなり、本来の密度分布と異なる結果となる可能性がある。そこで、本実施形態では、変化値計算部220は、パラメータ指定部300により指定されるパラメータを用いて変化値を計算する。このパラメータには、例えば、変化値の計算において対象とするデータ範囲を示す値等を含む。変化値計算で利用されるパラメータについては動作例の項において詳述する。   In the calculation of the change value, the change value calculation unit 220 may calculate data in a data accuracy range centered on each division candidate point. However, when the target data is small and there is missing data, if the change value is calculated only in the vicinity of the division candidate point, the change value becomes large due to the missing data, resulting in a result different from the original density distribution. there is a possibility. Therefore, in the present embodiment, the change value calculation unit 220 calculates the change value using the parameter specified by the parameter specification unit 300. This parameter includes, for example, a value indicating a data range as a target in the calculation of the change value. The parameters used in the change value calculation will be described in detail in the operation example section.

選択部230は、変化値計算部220で計算された各分割候補点における対象データの頻度の変化値に基づいて決定部210により決定された複数の分割候補点をサンプリングする。このサンプリングでは、頻度の変化の大きい分割候補点が重視され選択される。サンプリング数は、頻度の変化の大きい分割候補点が重視され、かつ、決定部210により決定された分割候補点の数よりも小さい数であれば、後述のパラメータ指定部300で指定される数に設定されてもよいし、その指定される数を上限値とした乱数で決定されてもよい。   The selection unit 230 samples the plurality of division candidate points determined by the determination unit 210 based on the change value of the frequency of the target data at each division candidate point calculated by the change value calculation unit 220. In this sampling, division candidate points with large frequency changes are emphasized and selected. If the number of sampling points with a large frequency change is emphasized and the number of sampling is smaller than the number of division candidate points determined by the determination unit 210, the number of samplings is set to a number specified by the parameter specification unit 300 described later. It may be set, or may be determined by a random number whose upper limit is the designated number.

具体的なサンプリング手法としては、例えば、以下の例が挙げられる。第1の例は、変化値の閾値をパラメータ指定部300から取得し、この閾値以上の変化値を持つ分割候補点を選択する手法である。第2の例は、この閾値以上の変化値を持つ分割候補点の中から更にランダムにサンプリングする手法である。第3の例は、変化値に比例した値で頻度の変化の大きい分割候補点を重点的に選択する手法である。なお、この第3の例については、動作例の項において詳述する。   Specific sampling methods include the following examples, for example. The first example is a method of acquiring a change value threshold value from the parameter designating unit 300 and selecting a division candidate point having a change value equal to or greater than the threshold value. The second example is a method of further sampling at random from among candidate division points having a change value equal to or greater than this threshold value. The third example is a method of intensively selecting a division candidate point having a large frequency change with a value proportional to the change value. This third example will be described in detail in the section of the operation example.

選択部230は、このサンプリングにより、決定部210により決定された分割候補点の数よりも少ない数の点を最終的な分割候補点として選択する。   By this sampling, the selection unit 230 selects a number of points smaller than the number of division candidate points determined by the determination unit 210 as final division candidate points.

ヒストグラム生成部240は、サンプリングされた分割候補点を使いヒストグラムを生成する。このとき、ヒストグラム生成部240は、選択部230により選択された分割候補点(サンプリングされた分割候補点)の中から最終的にヒストグラムを作成するのに利用する分割点を選択するようにしてもよいし、当該分割候補点をそのまま分割点として用いてもよい。図4は、ヒストグラムの例を示す図である。例えば、ヒストグラム生成部240は、図3の商品テーブルの価格に関し図4に示すようなヒストグラムを生成する。このヒストグラム生成手法には、上述したような周知の様々な方法が利用される。本実施形態は、このヒストグラム生成手法自体を限定するものではないため、ここでは説明を省略する。   The histogram generation unit 240 generates a histogram using the sampled division candidate points. At this time, the histogram generation unit 240 may select a division point to be finally used to create a histogram from the division candidate points selected by the selection unit 230 (sampled division candidate points). Alternatively, the division candidate point may be used as a division point as it is. FIG. 4 is a diagram illustrating an example of a histogram. For example, the histogram generation unit 240 generates a histogram as shown in FIG. 4 regarding the price of the product table of FIG. Various known methods as described above are used for this histogram generation method. Since the present embodiment does not limit the histogram generation method itself, description thereof is omitted here.

パラメータ指定部300は、ヒストグラム生成系200で使用される各種パラメータを指定する。例えば、変化値計算部220で使用されるパラメータ、選択部230で使用されるサンプル上限数、ヒストグラム生成部240で使用されるパラメータ等が指定される。なお、ヒストグラム生成部240で使用されるパラメータは、ヒストグラム生成手法に応じて決まる。   The parameter specifying unit 300 specifies various parameters used in the histogram generation system 200. For example, parameters used by the change value calculation unit 220, the upper limit number of samples used by the selection unit 230, parameters used by the histogram generation unit 240, and the like are designated. The parameters used in the histogram generation unit 240 are determined according to the histogram generation method.

例えば、パラメータ指定部300は、調整可能に設定されているユーザ設定ファイルから所望のパラメータを読み込んでもよいし、図示しないユーザインタフェースを通じて入力されたパラメータを取得してもよい。本実施形態は、パラメータ指定部300の具体的パラメータ指定方法を限定するものではない。   For example, the parameter specifying unit 300 may read a desired parameter from a user setting file that is set to be adjustable, or may acquire a parameter input through a user interface (not shown). This embodiment does not limit the specific parameter designation method of the parameter designation unit 300.

ヒストグラム格納部400は、ヒストグラム生成系200で生成されたヒストグラムを格納する。図5は、ヒストグラム格納テーブルの例を示す図である。例えば、ヒストグラム格納部400は、図4に示すようなヒストグラムを図5の例のような表形式で格納する。図5のヒストグラム格納テーブルの各レコードは、ヒストグラムの各ビンにそれぞれ対応し、左の分割点を開始値カラムに格納し、右の分割点を終了値カラムに格納し、その範囲のデータ数を出現数カラムにそれぞれ格納する。なお、本実施形態は、ヒストグラムの格納方式を限定しない。   The histogram storage unit 400 stores the histogram generated by the histogram generation system 200. FIG. 5 is a diagram illustrating an example of a histogram storage table. For example, the histogram storage unit 400 stores a histogram as shown in FIG. 4 in a table format as in the example of FIG. Each record in the histogram storage table of FIG. 5 corresponds to each bin of the histogram, stores the left division point in the start value column, stores the right division point in the end value column, and sets the number of data in the range. Store each in the occurrence number column. Note that this embodiment does not limit the histogram storage method.

データ問合せ部500は、ユーザからのデータの問合せ(SQL(Structured Query Language))を受け付け、その問合せに適合するデータをデータ格納部100から抽出して、抽出されたデータをユーザへ返す。データ問合せ部500は、問合せに適合するデータを抽出するにあたり、その問合せを最適化する。具体的には、データ問合せ部500は、ユーザから発行されたSQLからいくつかの実行プランを生成し、各実行プランに対してヒストグラムを参照しながら実行コストをそれぞれ算出する。データ問合せ部500は、算出された実行コストが最も小さい実行プランを選択して実行する。   The data inquiry unit 500 receives a data query (SQL (Structured Query Language)) from the user, extracts data that matches the query from the data storage unit 100, and returns the extracted data to the user. The data inquiry unit 500 optimizes the query when extracting data that matches the query. Specifically, the data inquiry unit 500 generates several execution plans from the SQL issued by the user, and calculates execution costs while referring to the histogram for each execution plan. The data inquiry unit 500 selects and executes the execution plan having the lowest calculated execution cost.

〔動作例〕
以下、第1実施形態におけるDBシステム10の動作例について説明する。
まず、図6を用いて、ヒストグラム生成時におけるDBシステム10の動作例を説明する。図6は、第1実施形態におけるDBシステム10のヒストグラム生成時の動作例を示すフローチャートである。
[Operation example]
Hereinafter, an operation example of the DB system 10 in the first embodiment will be described.
First, an example of the operation of the DB system 10 when generating a histogram will be described with reference to FIG. FIG. 6 is a flowchart illustrating an operation example when generating a histogram of the DB system 10 according to the first embodiment.

パラメータ指定部300は、ヒストグラム生成系200で使用される各種パラメータを取得し、取得された各種パラメータをヒストグラム生成系200へ送る(S100)。この各種パラメータは、例えば、設定ファイルから読み出される。また、パラメータ指定部300は、予め決められた既定のパラメータ値を利用してもよい。   The parameter specifying unit 300 acquires various parameters used in the histogram generation system 200 and sends the acquired various parameters to the histogram generation system 200 (S100). These various parameters are read from a setting file, for example. The parameter specifying unit 300 may use a predetermined parameter value determined in advance.

決定部210は、データ格納部100からヒストグラムを生成したい対象データを取得する(S110)。例えば、決定部210は、図3の商品テーブルの価格データに関してヒストグラムを作る場合には、以下のようなデータXを得る。
X={6980、8600、1980、100000、1980、...}
The determination unit 210 acquires target data for which a histogram is to be generated from the data storage unit 100 (S110). For example, the determination unit 210 obtains the following data X when creating a histogram for the price data in the product table of FIG.
X = {6980, 8600, 1980, 100,000, 1980, ...}

次に、決定部210は、上記処理(S110)で得られたデータから複数の分割候補点を決定する(S120)。この分割候補点の決定方法には複数の方法が考えられるが、ここでは、2種類の決定方法について例を挙げる。   Next, the determination unit 210 determines a plurality of division candidate points from the data obtained in the above process (S110) (S120). A plurality of methods can be considered as the method for determining the division candidate points. Here, examples of two types of determination methods are given.

第1の決定方法は、対象データが取り得る全ての値の前後にそれぞれ分割候補点を配置する方法である。例えば、第1の方法で決定される分割候補点の集合は、以下のC1で示すことができる。
C1={x_min+e/2+t×e | t=0、1、...、(x_max−x_min)/e−1}
The first determination method is a method in which division candidate points are arranged before and after all values that can be taken by the target data. For example, the set of candidate division points determined by the first method can be represented by C1 below.
C1 = {x_min + e / 2 + t × e | t = 0, 1,. . . , (X_max−x_min) / e−1}

ここで、x_minは、対象データの最小値を示し、x_maxは、対象データの最大値を示し、eは、対象データの精度を示す。図3の商品テーブルの価格データの例において、対象データの精度が10に設定されたと仮定すると、各分割候補点は、10円単位にそれぞれ設定される。   Here, x_min indicates the minimum value of the target data, x_max indicates the maximum value of the target data, and e indicates the accuracy of the target data. In the example of price data in the product table in FIG. 3, assuming that the accuracy of the target data is set to 10, each division candidate point is set in units of 10 yen.

第2の決定方法は、対象データの全てのデータ点の前後にそれぞれ分割候補点を配置する方法である。例えば、第2の方法で決定される分割候補点の集合は、以下のC2で示すことができる。
C2={x_j−e/2 | x_j∈X}∪{x_j+e/2 |x_j∈X}
The second determination method is a method of arranging division candidate points before and after all data points of the target data. For example, the set of candidate division points determined by the second method can be represented by the following C2.
C2 = {x_j−e / 2 | x_jεX} ∪ {x_j + e / 2 | x_jεX}

ここで、Xは対象データの集合を示し、x_jは各対象データを示し、eは対象データの精度を示す。   Here, X represents a set of target data, x_j represents each target data, and e represents the accuracy of the target data.

上記第1の決定方法によれば、分割候補点の集合C1は、対象データから最大値と最小値とを取得すれば自動的に決定することができる。一方、第2の決定方法によれば、分割候補点の集合C2は、全ての対象データに関して前後に分割候補点を設けることにより決定することができる。なお、本実施形態は、このような2種類の分割候補点の決定方法に限定するものではない。   According to the first determination method, the set C1 of candidate division points can be automatically determined if the maximum value and the minimum value are acquired from the target data. On the other hand, according to the second determination method, the set C2 of candidate division points can be determined by providing candidate division points before and after all the target data. Note that the present embodiment is not limited to such two types of division candidate point determination methods.

次に、変化値計算部220は、処理(S120)で決定された複数の分割候補点に対して変化値をそれぞれ計算する(S130)。図7は、分割候補点の変化値の計算方法の例を概念的に示す図である。図7の例では、当該変化値の計算において、パラメータ指定部300から指定される2つのパラメータε及びdxが利用される。パラメータdxは変化値を求める上でのデータ範囲を示す。パラメータdxの値がデータ精度に設定された場合には、分割候補点に隣接するデータ範囲のみを対象に変化値が計算され、データ精度よりも大きく設定された場合には、分割候補点を中心により広い範囲のデータ傾向が反映された変化値が計算される。   Next, the change value calculation unit 220 calculates a change value for each of the plurality of candidate division points determined in the process (S120) (S130). FIG. 7 is a diagram conceptually illustrating an example of a method for calculating a change value of a division candidate point. In the example of FIG. 7, two parameters ε and dx specified by the parameter specifying unit 300 are used in calculating the change value. The parameter dx indicates a data range for obtaining the change value. When the value of the parameter dx is set to data accuracy, the change value is calculated only for the data range adjacent to the division candidate point, and when it is set to be larger than the data accuracy, the division candidate point is centered. A change value reflecting a wider range of data trends is calculated.

また、図7において、関数f(x)は、パラメータεを用いて、[x−ε/2、x+ε/2](開区間)の値がデータに出現する頻度を示す。この場合、変化値計算部220は、変化値P(x)を以下の式により算出する。
(x)=|f(x1−dx/2)−f(x1+dx/2)|/dx
In FIG. 7, the function f (x) indicates the frequency with which the value of [x−ε / 2, x + ε / 2] (open interval) appears in the data using the parameter ε. In this case, the change value calculation unit 220 calculates the change values P to (x) by the following formula.
P to (x) = | f (x1−dx / 2) −f (x1 + dx / 2) | / dx

結果、算出される変化値は、図7における矢印の傾きを表す。図8は、分割候補点に対する変化値の算出例を概念的に示す図である。パラメータdx及びεは、データの精度に設定されてもよい。また、データの精度に対して対象データが少なくデータの抜けが存在する場合には、パラメータdx及びεは、データ精度より大きい値に設定されてもよい。   As a result, the calculated change value represents the slope of the arrow in FIG. FIG. 8 is a diagram conceptually illustrating a calculation example of the change value for the division candidate point. The parameters dx and ε may be set to data accuracy. Further, when the target data is small with respect to the data accuracy and there is data omission, the parameters dx and ε may be set to a value larger than the data accuracy.

次に、選択部230は、各分割候補点における変化値(P(x))が確率分布となるように各変化値を正規化する。各分割候補点における変化値(P(x))が正規化された値をP(x)とすると、例えば、その正規化は以下の式で示すことができる。
P(x)=P(x)/ΣP(x)
Next, the selection unit 230 normalizes each change value so that the change values (P to (x)) at each division candidate point have a probability distribution. Assuming that a value obtained by normalizing the change values (P to (x)) at each division candidate point is P (x), the normalization can be expressed by the following expression, for example.
P (x) = P ~ ( x) / ΣP ~ (x)

選択部230は、このように正規化された変化値の確率分布(P(x))に基づいて、処理(S120)で決定された複数の分割候補点のうちのN個を分割候補点として選択する(S140)。サンプリング数Nは、例えば、パラメータ指定部300から取得される。例えば、選択部230は、確率分布(P(x))に従いランダムにパラメータ指定部300から指定されたサンプリング数Nを上限として分割候補点を選択する。   The selection unit 230 uses N of the plurality of division candidate points determined in the process (S120) as division candidate points based on the probability distribution (P (x)) of the change values normalized in this way. Select (S140). The sampling number N is acquired from the parameter specifying unit 300, for example. For example, the selection unit 230 selects the division candidate points with the sampling number N specified from the parameter specification unit 300 as an upper limit at random according to the probability distribution (P (x)).

ヒストグラム生成部240は、上記処理(S140)でサンプリングされた分割候補点を用いてヒストグラムを生成する(S150)。このヒストグラム生成方法には、例えば、分割候補点の数に計算量が依存するヒストグラム生成方法(例えば、非特許文献2、非特許文献3で提案されている方法等)が利用される。なお、ヒストグラム生成方法毎にパラメータが必要な場合には、パラメータ指定部300から各種パラメータが取得される。   The histogram generation unit 240 generates a histogram using the candidate division points sampled in the above process (S140) (S150). As this histogram generation method, for example, a histogram generation method whose calculation amount depends on the number of division candidate points (for example, a method proposed in Non-Patent Document 2 and Non-Patent Document 3) is used. When parameters are required for each histogram generation method, various parameters are acquired from the parameter specifying unit 300.

ヒストグラム生成部240は、上記処理(S150)で生成されたヒストグラムをヒストグラム格納部400に格納する(S160)。   The histogram generation unit 240 stores the histogram generated in the above process (S150) in the histogram storage unit 400 (S160).

次に、上述のように生成されたヒストグラムを用いてデータ問合せに対する処理をする際におけるDBシステム10の動作例について説明する。   Next, an operation example of the DB system 10 when processing a data query using the histogram generated as described above will be described.

データ問合せ部500は、ユーザからの問い合わせSQLを構文解析した後に、いくつかのSQLの実行プランを生成する。例えば、データ格納部100に図2及び図3に示すようなデータが格納されている場合に、そのデータに対して、次のようなSQL問い合わせがあったと仮定する。
SELECT * FROM 購買T、商品T WHERE 日時>08/10 AND 価格>5000 AND 購買T.商品ID=商品T.商品ID;
The data inquiry unit 500 generates an SQL execution plan after parsing the inquiry SQL from the user. For example, when data as shown in FIGS. 2 and 3 is stored in the data storage unit 100, it is assumed that the following SQL query has been made for the data.
SELECT * FROM Purchasing T, Commodity T WHERE Date &Time> 08/10 AND Price> 5000 AND Purchasing T. Product ID = Product T. Product ID;

このとき、データ問合せ部500は、例えば、図9A及び図9Bに示す2つの実行プランを生成する。図9A及び図9Bは、実行プランの例を示す図である。この2つの実行プランは、2つのテーブルの結合を含んでいる。データ問合せ部500は、2つのテーブルを入れ子ループ結合(Nested loop join)する場合のコストとして、例えば、次式を用いて各実行プランのコストをそれぞれ計算する。
P1+Ceil(P1/(M−1))×P2
At this time, the data inquiry unit 500 generates, for example, two execution plans shown in FIGS. 9A and 9B. 9A and 9B are diagrams illustrating examples of execution plans. The two execution plans include a join between the two tables. The data inquiry unit 500 calculates the cost of each execution plan, for example, using the following equation as the cost when the two tables are nested loop joined.
P1 + Ceil (P1 / (M−1)) × P2

ここで、P1は、外側ループテーブルのページ数を示し、P2は、内側ループテーブルのページ数を示し、Mは、作業バッファサイズを示す。また、Ceil(n)は、nに指定した値以上で最も小さな整数値を求める関数である。なお、このようなコストの計算手法は、周知な手法が利用されればよく(北川博之著のデータベースシステム等参照)、本実施形態ではその計算手法を限定しないため、ここでは説明を簡略化する。   Here, P1 indicates the number of pages in the outer loop table, P2 indicates the number of pages in the inner loop table, and M indicates the work buffer size. Ceil (n) is a function for obtaining the smallest integer value greater than or equal to the value specified for n. It is sufficient that a known method is used for such a cost calculation method (see Hiroyuki Kitagawa's database system, etc.), and in this embodiment, the calculation method is not limited, so the description is simplified here. .

データ問合せ部500は、上述のコストを算出するために、外側ループテーブル及び内側ループテーブルの各ページ数(P1及びP2)を各テーブルの選択率から求める。データ問合せ部500は、上述のように生成されヒストグラム格納部400に格納されているヒストグラムを用いて、当該選択率を取得する。この選択率とは、抽出されたレコード数の全体レコード数に対する割合を意味する。   The data inquiry unit 500 calculates the number of pages (P1 and P2) of the outer loop table and the inner loop table from the selection rate of each table in order to calculate the above-described cost. The data inquiry unit 500 acquires the selection rate using the histogram generated as described above and stored in the histogram storage unit 400. This selection rate means the ratio of the number of extracted records to the total number of records.

ここで、図9Aの実行プランのコストを算出する場合、結合の外側ループに、購買テーブルから「日時>08/10」で抽出したレコードが使われ、内側ループに、商品テーブルから「価格>5000」で抽出したレコードが使われる。データ問合せ部500は、各ページ数を得るために、ヒストグラム格納部400に格納されているヒストグラムを用いて各選択率をそれぞれ求める。   Here, when calculating the cost of the execution plan of FIG. 9A, a record extracted from the purchase table with “date and time> 08/10” is used for the outer loop of the join, and “price> 5000” from the product table is used for the inner loop. ”Is used. The data inquiry unit 500 obtains each selection rate using the histogram stored in the histogram storage unit 400 in order to obtain the number of pages.

例えば、図3の商品テーブルの価格データに関し、ヒストグラム格納部400に図10に示すヒストグラムが格納されていると仮定する。図10は、ヒストグラム格納テーブルの第2例を示す図である。このとき、データ問合せ部500は、「価格>5000」で抽出されるレコード数を、開始値が5000より大きい範囲の出現数(300=100+100+20+80)により取得し、この出現数の、全体の出現数(500)に対する割合(60%)を商品テーブルから「価格>5000」で抽出する場合の選択率として求める。   For example, it is assumed that the histogram shown in FIG. 10 is stored in the histogram storage unit 400 for the price data of the product table of FIG. FIG. 10 is a diagram illustrating a second example of the histogram storage table. At this time, the data inquiry unit 500 obtains the number of records extracted with “price> 5000” from the number of appearances (300 = 100 + 100 + 20 + 80) in the range where the start value is greater than 5000, and the total number of appearances of this number of appearances A ratio (60%) with respect to (500) is obtained as a selection rate in the case of extracting “price> 5000” from the product table.

同様にして、データ問合せ部500は、購買テーブルから「日時>08/10」で抽出する場合の選択率をヒストグラム格納部400に格納されているヒストグラムに基づいて求める。ここでは、その選択率が10%として取得されたものと仮定する。更に、購買テーブルのページ数が500、商品テーブルのページ数が30、作業バッファサイズMが5であると仮定すると、図9A及び図9Bの各実行プランのコストはそれぞれ以下のように算出される。   Similarly, the data inquiry unit 500 obtains the selection rate when extracting from the purchase table with “date and time> 08/10” based on the histogram stored in the histogram storage unit 400. Here, it is assumed that the selectivity is acquired as 10%. Further, assuming that the number of pages in the purchase table is 500, the number of pages in the product table is 30, and the work buffer size M is 5, the cost of each execution plan in FIGS. 9A and 9B is calculated as follows: .

図9Aの実行プランのコスト=500×0.1+Ceil(500×0.1/4)×30×0.6=284
図9Bの実行プランのコスト=30×0.6+Ceil(30×0.6/4)×500×0.1=268
The cost of the execution plan in FIG. 9A = 500 × 0.1 + Ceil (500 × 0.1 / 4) × 30 × 0.6 = 284
The cost of the execution plan in FIG. 9B = 30 × 0.6 + Ceil (30 × 0.6 / 4) × 500 × 0.1 = 268

この例によれば、図9Bの実行プランの方が図9Aよりもコストが小さい。従って、データ問合せ部500は、図9Bの実行プランを実行して結果を得る。図11は、データ問合せ処理の結果、抽出されたレコードの例を示す図である。   According to this example, the cost of the execution plan of FIG. 9B is lower than that of FIG. 9A. Therefore, the data inquiry unit 500 executes the execution plan of FIG. 9B and obtains a result. FIG. 11 is a diagram illustrating an example of records extracted as a result of the data inquiry process.

〔第1実施形態の作用及び効果〕
上述の第1実施形態におけるDBシステム10では、決定部210が、ヒストグラム生成の対象となるデータから、ヒストグラムの各区間を決めるための複数の分割候補点を決定する。続いて、変化値計算部220が、各分割候補点における対象データの頻度の変化値をそれぞれ計算し、選択部230が、各変化値に基づいて、頻度の変化の大きい分割候補点が重視され選択されるように複数の分割候補点をサンプリングする。結果、ヒストグラム生成部240が、サンプリングされることにより、対象データに基づいて決められた分割候補点の数よりも少ない数に設定された分割候補点を用いて対象データのヒストグラムを生成する。
[Operation and Effect of First Embodiment]
In the DB system 10 in the first embodiment described above, the determination unit 210 determines a plurality of division candidate points for determining each section of the histogram from the data that is the target of histogram generation. Subsequently, the change value calculation unit 220 calculates the change value of the frequency of the target data at each division candidate point, and the selection unit 230 attaches importance to the division candidate points having a large frequency change based on each change value. A plurality of division candidate points are sampled so as to be selected. As a result, the histogram generation unit 240 generates a histogram of the target data using the division candidate points set to a number smaller than the number of division candidate points determined based on the target data by sampling.

このように、選択部230により、対象データに基づいて決定された分割候補点が一定数以下でサンプリングされるため、分割候補点の数に計算量が依存するヒストグラム生成方法が採用されたとしても、高速にヒストグラムを生成することができる。   As described above, the selection unit 230 samples the division candidate points determined based on the target data at a predetermined number or less, so even if a histogram generation method in which the calculation amount depends on the number of division candidate points is adopted. A histogram can be generated at high speed.

更に、第1実施形態では、対象データに基づいて決定された複数の分割候補点の中から、分割に不要な点が省かれ、分割に重要な点が重点的に分割候補点として選択される。ヒストグラムの各区間を決めるための分割点は、上述したように、急激に頻度が変化する部分に多く置かれることが好ましい。第1実施形態では、この分割の重要性が変化値により評価される。   Furthermore, in the first embodiment, points unnecessary for division are omitted from a plurality of division candidate points determined based on the target data, and points important for division are selected as division candidate points. . As described above, it is preferable that a large number of division points for determining each section of the histogram be placed in a portion where the frequency changes rapidly. In the first embodiment, the importance of this division is evaluated by the change value.

従って、第1実施形態によれば、分割候補点を削減したとしても、分割に重要な点を重点的に選択しているため、ヒストグラムの精度の低下を抑えることができる。   Therefore, according to the first embodiment, even if the division candidate points are reduced, since the points important for the division are selected with priority, it is possible to suppress a decrease in accuracy of the histogram.

[第2実施形態]
上述の第1実施形態では、パラメータ指定部300においてサンプリング数の上限値が指定されていたが、第2実施形態は、ヒストグラム生成時間を指定可能に実現される。以下、第2実施形態におけるDBシステム10について第1実施形態と異なる内容を中心に説明し、同一の内容については説明を適宜省略する。
[Second Embodiment]
In the first embodiment described above, the upper limit value of the number of samplings is specified in the parameter specifying unit 300, but the second embodiment is realized so that the histogram generation time can be specified. Hereinafter, the DB system 10 in the second embodiment will be described focusing on the contents different from the first embodiment, and the description of the same contents will be omitted as appropriate.

〔システム構成〕
図12は、第2実施形態におけるDBシステム10の構成例を示す概念図である。図12に示すように、第2実施形態におけるDBシステム10は、第1実施形態の構成に加えて、処理時間格納部600を更に有する。処理時間格納部600は、RAM(Random Access Memory)、HDD(Hard Disk Drive)などのようなメモリ上に実現される。
〔System configuration〕
FIG. 12 is a conceptual diagram illustrating a configuration example of the DB system 10 in the second embodiment. As shown in FIG. 12, the DB system 10 in the second embodiment further includes a processing time storage unit 600 in addition to the configuration of the first embodiment. The processing time storage unit 600 is realized on a memory such as a RAM (Random Access Memory), an HDD (Hard Disk Drive), or the like.

パラメータ指定部300は、分割候補点のサンプリング数の上限値に加え、ヒストグラム生成希望時間を選択部230に送る。このヒストグラム生成希望時間とは、ヒストグラム生成に費やす時間長であってユーザ等により希望される時間長である。このヒストグラム生成希望時間は、サンプリング数の上限値等と共に、設定ファイルに格納されていてもよいし、ユーザインタフェース等を介して取得されてもよい。   The parameter specifying unit 300 sends the histogram generation desired time to the selection unit 230 in addition to the upper limit value of the sampling number of the division candidate points. The histogram generation desired time is a time length spent for generating a histogram and is a time length desired by a user or the like. The desired histogram generation time may be stored in a setting file together with the upper limit value of the number of samplings, or may be acquired via a user interface or the like.

図13は、処理時間格納部600に格納される処理時間データの例を示す図である。図13の例に示すように、処理時間格納部600は、分割候補点のサンプリング数に対して、実際にヒストグラムを生成するのに費やされた時間を格納する。   FIG. 13 is a diagram illustrating an example of processing time data stored in the processing time storage unit 600. As illustrated in the example of FIG. 13, the processing time storage unit 600 stores the time spent for actually generating the histogram with respect to the sampling number of the division candidate points.

選択部230は、パラメータ指定部300から取得されたサンプリング数の上限値及びヒストグラム生成希望時間、並びに、処理時間格納部600に格納される処理時間データに基づいて、分割候補点のサンプリング数を決定する。具体的には、処理時間格納部600に所定レコード数の処理時間データが格納されている場合には、選択部230は、処理時間格納部600から抽出された処理時間データから、サンプリング数の上限値を超えない範囲で、ヒストグラム生成希望時間に相当するサンプリング数を決定する。   The selection unit 230 determines the sampling number of the division candidate points based on the upper limit value of the sampling number acquired from the parameter specification unit 300, the histogram generation desired time, and the processing time data stored in the processing time storage unit 600. To do. Specifically, when processing time data of a predetermined number of records is stored in the processing time storage unit 600, the selection unit 230 determines the upper limit of the number of samplings from the processing time data extracted from the processing time storage unit 600. The number of samplings corresponding to the histogram generation desired time is determined within a range not exceeding the value.

ヒストグラム生成部240は、ヒストグラムの生成に要した時間を測り、計測された生成時間及びそのときのサンプリング数を処理時間格納部600に格納する。   The histogram generation unit 240 measures the time required to generate the histogram, and stores the measured generation time and the number of samplings at that time in the processing time storage unit 600.

〔動作例〕
図14は、第2実施形態におけるDBシステム10のヒストグラム生成時の動作例を示すフローチャートである。
[Operation example]
FIG. 14 is a flowchart illustrating an operation example when generating a histogram of the DB system 10 according to the second embodiment.

パラメータ指定部300は、第1実施形態で利用される各種パラメータ(例えば、サンプリング数の上限値)に加えて、ヒストグラム生成希望時間をヒストグラム生成系200へ送る(S101)。以降、(S110)、(S120)及び(S130)の各処理については第1実施形態と同様である(図6参照)。   The parameter specifying unit 300 sends the desired histogram generation time to the histogram generation system 200 in addition to the various parameters (for example, the upper limit value of the number of samplings) used in the first embodiment (S101). Henceforth, each process of (S110), (S120), and (S130) is the same as that of 1st Embodiment (refer FIG. 6).

選択部230は、分割候補点のサンプリングを実行する前に、サンプリング数を計算し、決定する(S141)。具体的には、選択部230は、処理時間格納部600に所定レコード数以上のデータが格納されている場合には、サンプリング数及び処理時間を含むレコードを抽出し、抽出されたサンプリング数及び処理時間の複数の組み合わせを用いて回帰分析を行う。選択部230は、得られた回帰曲線から、ヒストグラム生成希望時間に対応する値を算出し、算出された値をサンプリング数に決定する。なお、処理時間格納部600に所定レコード数以上のデータがない場合には、第1実施形態と同様の手法によりサンプリング数が決定されればよい。   The selection unit 230 calculates and determines the number of samplings before sampling the division candidate points (S141). Specifically, when data of a predetermined number of records or more is stored in the processing time storage unit 600, the selection unit 230 extracts records including the sampling number and processing time, and the extracted sampling number and processing Regression analysis is performed using multiple combinations of time. The selection unit 230 calculates a value corresponding to the desired histogram generation time from the obtained regression curve, and determines the calculated value as the number of samplings. If the processing time storage unit 600 does not have more data than the predetermined number of records, the sampling number may be determined by the same method as in the first embodiment.

以降、選択部230は、この決定されたサンプリング数により分割候補点のサンプリングを行う(S140)。その後の処理(S150)及び(S160)は第1実施形態と同様である。   Thereafter, the selection unit 230 samples the division candidate points according to the determined sampling number (S140). The subsequent processes (S150) and (S160) are the same as in the first embodiment.

ヒストグラム格納部400にヒストグラムを格納すると、ヒストグラム生成部240は、そのヒストグラムの生成にかかった処理時間と、そのときの分割候補点のサンプリング数とを処理時間格納部600に格納する(S161)。   When the histogram is stored in the histogram storage unit 400, the histogram generation unit 240 stores in the processing time storage unit 600 the processing time taken to generate the histogram and the number of division candidate points sampled at that time (S161).

〔第2実施形態の作用及び効果〕
このように第2実施形態では、ヒストグラム生成部240によりヒストグラムが生成されると、その処理時間とサンプリング数(分割候補点数)とが処理時間格納部600に格納される。ヒストグラム生成に利用される分割候補点の数となるサンプリング数は、処理時間格納部600に格納される処理時間とサンプリング数との履歴データに基づいて、ユーザ等により望まれるヒストグラム生成希望時間に対応する値に決定される。
[Operation and Effect of Second Embodiment]
Thus, in the second embodiment, when a histogram is generated by the histogram generation unit 240, the processing time and the number of samplings (number of division candidate points) are stored in the processing time storage unit 600. The sampling number, which is the number of candidate division points used for generating the histogram, corresponds to the desired histogram generation time desired by the user or the like based on the history data of the processing time and the sampling number stored in the processing time storage unit 600. The value to be determined.

このように、第2実施形態によれば、例えば、複数のサンプリング数の各々で前もって複数のヒストグラムを生成し、処理時間格納部600に履歴データを格納しておくことにより、ユーザ等が希望する生成時間に近似する時間でヒストグラムの生成を行うことができる。これは、処理時間格納部600に格納される履歴データの回帰分析により所望される時間に対応するサンプリング数を計算することができるからである。   As described above, according to the second embodiment, for example, a plurality of histograms are generated in advance at each of a plurality of sampling numbers, and history data is stored in the processing time storage unit 600, so that a user or the like desires. A histogram can be generated at a time approximate to the generation time. This is because the sampling number corresponding to the desired time can be calculated by regression analysis of the history data stored in the processing time storage unit 600.

ユーザは、ヒストグラム生成に費やされる時間として許容する時間の感覚を認識することはできるが、その許容する時間でヒストグラムを生成させるためのサンプリング数を認識することは困難である。そのため、ユーザにとってサンプリング数を指定できるよりもヒストグラム生成希望時間を指定できる方が有益な場合が多い。よって、第2実施形態によれば、ユーザフレンドリーなシステムを提供することができる。   The user can recognize the sense of time allowed as the time spent for generating the histogram, but it is difficult to recognize the number of samplings for generating the histogram at the allowable time. For this reason, it is often more useful for the user to specify the desired histogram generation time than to specify the sampling number. Therefore, according to the second embodiment, a user-friendly system can be provided.

[変形例]
上述の各実施形態では、選択部230は、決定部210により決定された複数の分割候補点をサンプリングすることにより1つの分割候補点の集合を決定していた。しかしながら、選択部230は、複数タイプの分割候補点の集合を決定するようにしてもよい。つまり、選択部230は、サンプリング数の上限値を超えない範囲又はヒストグラム生成希望時間に対応して決定されたサンプリング数の集合であって、各集合に含まれる少なくとも1つの分割候補点がそれぞれ異なる分割候補点の集合を決定する。
[Modification]
In each of the above-described embodiments, the selection unit 230 determines a set of one division candidate point by sampling the plurality of division candidate points determined by the determination unit 210. However, the selection unit 230 may determine a set of a plurality of types of division candidate points. That is, the selection unit 230 is a set of sampling numbers determined corresponding to a range that does not exceed the upper limit value of the sampling number or the histogram generation desired time, and at least one division candidate point included in each set is different. A set of candidate division points is determined.

この場合、選択部230は、決定された複数タイプの分割候補点の集合をヒストグラム生成部240に提供する。ヒストグラム生成部240は、各集合についてそれぞれヒストグラムを生成し、生成されたヒストグラムのうち最も評価の高いヒストグラムをヒストグラム格納部400に格納する。なお、ヒストグラムの評価手法は、周知技術が利用されればよいため(例えば、非特許文献2及び非特許文献3参照)、ここでは説明を省略する。   In this case, the selection unit 230 provides the histogram generation unit 240 with a set of the determined plural types of division candidate points. The histogram generation unit 240 generates a histogram for each set, and stores the histogram having the highest evaluation among the generated histograms in the histogram storage unit 400. In addition, since a well-known technique should just be utilized for the evaluation method of a histogram (for example, refer nonpatent literature 2 and nonpatent literature 3), description is abbreviate | omitted here.

このような変形例によれば、ヒストグラム生成の高速化を実現することができると共に、安定的にヒストグラムの精度の低下を抑えることができる。   According to such a modification, it is possible to realize a high speed generation of the histogram and to stably suppress a decrease in the accuracy of the histogram.

なお、上記実施形態の説明には、複数のフローチャートを用いており、それぞれに複数のステップを順番に記載してあるが、その複数のステップの順番は内容的に支障しない範囲で変更することができる。また、上述した実施の形態および複数の変形例は、その内容が相反しない範囲で組み合わせることができる。   In the description of the above embodiment, a plurality of flowcharts are used, and a plurality of steps are described in order, but the order of the plurality of steps may be changed within a range that does not hinder the contents. it can. Further, the above-described embodiment and a plurality of modified examples can be combined within a range in which the contents do not conflict with each other.

10 関係データベースシステム(DBシステム)
100 データ格納部
200 ヒストグラム生成系
210 分割候補点決定部(決定部)
220 変化値計算部
230 分割候補点選択部(選択部)
240 ヒストグラム生成部
300 パラメータ指定部
400 ヒストグラム格納部
500 データ問合せ部
600 処理時間格納部
10 Relational database system (DB system)
DESCRIPTION OF SYMBOLS 100 Data storage part 200 Histogram generation system 210 Division | segmentation candidate point determination part (determination part)
220 change value calculation unit 230 division candidate point selection unit (selection unit)
240 Histogram generation unit 300 Parameter specification unit 400 Histogram storage unit 500 Data inquiry unit 600 Processing time storage unit

Claims (7)

ヒストグラム生成のための対象データに基づいて、該ヒストグラムの各区間を決めるための分割点の候補となる複数の分割候補点を決定する決定手段と、
前記各分割候補点における前記対象データの頻度の変化値をそれぞれ計算する変化値計算手段と、
前記変化値計算手段で計算された各変化値に基づいて前記複数の分割候補点をサンプリングすることにより、前記決定手段により決定された分割候補点の数よりも少ない数の分割候補点を選択する選択手段と、
前記選択手段により選択された分割候補点を用いて前記対象データのヒストグラムを生成するヒストグラム生成手段と、
を備えることを特徴とするヒストグラム生成装置。
Determining means for determining a plurality of division candidate points to be candidates for division points for determining each section of the histogram based on target data for generating a histogram;
Change value calculating means for calculating a change value of the frequency of the target data at each of the division candidate points;
By sampling the plurality of division candidate points based on each change value calculated by the change value calculation unit, a smaller number of division candidate points than the number of division candidate points determined by the determination unit are selected. A selection means;
A histogram generation means for generating a histogram of the target data using the division candidate points selected by the selection means;
A histogram generating apparatus comprising:
前記変化値計算手段に前記変化値の計算対象とするデータ範囲を示すパラメータを送るパラメータ指定手段、
を更に備え、
前記変化値計算手段は、前記パラメータ指定手段から取得した前記パラメータの示すデータ範囲で、前記各分割候補点における前記対象データの頻度の変化値をそれぞれ計算する、
ことを特徴とする請求項1に記載のヒストグラム生成装置。
Parameter specifying means for sending a parameter indicating a data range to be calculated of the change value to the change value calculating means,
Further comprising
The change value calculation means calculates a change value of the frequency of the target data at each division candidate point in the data range indicated by the parameter acquired from the parameter specifying means,
The histogram generation apparatus according to claim 1.
前記パラメータ指定手段は、前記選択手段で利用されるサンプリング数の上限値を前記選択手段に送り、
前記選択手段は、前記パラメータ指定手段から取得した前記上限値を超えない範囲で、前記決定手段により決定された分割候補点の数よりも少ない数の分割候補点を選択する、
ことを特徴とする請求項2に記載のヒストグラム生成装置。
The parameter designation means sends an upper limit value of the number of samplings used by the selection means to the selection means,
The selection means selects a number of division candidate points that is less than the number of division candidate points determined by the determination means within a range that does not exceed the upper limit value acquired from the parameter designation means.
The histogram generating apparatus according to claim 2, wherein:
前記選択手段によるサンプリングのためのサンプリング数と該サンプリング数で選択された分割候補点を用いた前記ヒストグラム生成手段によるヒストグラム生成の処理時間との複数の組み合わせを格納する処理時間格納手段、
を更に備え、
前記パラメータ指定手段は、ヒストグラム生成希望時間を前記選択手段に送り、
前記選択手段は、前記処理時間格納手段に格納された複数の組み合わせを分析することにより、前記パラメータ指定手段から送られたヒストグラム生成希望時間に対応するサンプリング数を算出し、算出されたサンプリング数の分割候補点が選択されるようにサンプリングを行う、
ことを特徴とする請求項2又は3に記載のヒストグラム生成装置。
Processing time storage means for storing a plurality of combinations of the sampling number for sampling by the selection means and the processing time of histogram generation by the histogram generation means using the division candidate points selected by the sampling number;
Further comprising
The parameter specifying means sends a histogram generation desired time to the selection means,
The selection unit calculates a sampling number corresponding to the histogram generation desired time sent from the parameter designating unit by analyzing a plurality of combinations stored in the processing time storage unit, and calculates the number of samplings calculated. Sampling so that candidate division points are selected,
The histogram generation apparatus according to claim 2 or 3, wherein
前記選択手段は、前記分割候補点の数よりも少ない数の分割候補点をそれぞれ含む複数タイプの分割候補点集合を選択し、
前記ヒストグラム生成手段は、前記選択手段により選択された複数の分割候補点集合の各々を用いて複数のヒストグラムを生成し、生成された複数のヒストグラムのいずれか1つを出力する、
ことを特徴とする請求項1から4のいずれか1項に記載のヒストグラム生成装置。
The selection means selects a plurality of types of division candidate point sets each including a number of division candidate points smaller than the number of division candidate points,
The histogram generation means generates a plurality of histograms using each of the plurality of division candidate point sets selected by the selection means, and outputs any one of the generated plurality of histograms.
The histogram generation device according to claim 1, wherein
コンピュータが、
ヒストグラム生成のための対象データに基づいて、該ヒストグラムの各区間を決めるための分割点の候補となる複数の分割候補点を決定し、
前記各分割候補点における前記対象データの頻度の変化値をそれぞれ計算し、
前記計算された各変化値に基づいて前記複数の分割候補点をサンプリングすることにより、前記分割候補点の数よりも少ない数の分割候補点を選択し、
前記選択された分割候補点を用いて前記対象データのヒストグラムを生成する、
ことを含むヒストグラム生成方法。
Computer
Based on target data for generating a histogram, a plurality of division candidate points that are candidates for division points for determining each section of the histogram are determined;
Calculate a change value of the frequency of the target data at each of the division candidate points,
By sampling the plurality of division candidate points based on the calculated change values, a number of division candidate points smaller than the number of division candidate points is selected,
Generating a histogram of the target data using the selected candidate division points;
Histogram generation method including the above.
コンピュータを、
ヒストグラム生成のための対象データに基づいて、該ヒストグラムの各区間を決めるための分割点の候補となる複数の分割候補点を決定する決定手段と、
前記各分割候補点における前記対象データの頻度の変化値をそれぞれ計算する変化値計算手段と、
前記変化値計算手段で計算された各変化値に基づいて前記複数の分割候補点をサンプリングすることにより、前記決定手段により決定された分割候補点の数よりも少ない数の分割候補点を選択する選択手段と、
前記選択手段により選択された分割候補点を用いて前記対象データのヒストグラムを生成するヒストグラム生成手段、
として機能させることを特徴とするヒストグラム生成プログラム。
Computer
Determining means for determining a plurality of division candidate points to be candidates for division points for determining each section of the histogram based on target data for generating a histogram;
Change value calculating means for calculating a change value of the frequency of the target data at each of the division candidate points;
By sampling the plurality of division candidate points based on each change value calculated by the change value calculation unit, a smaller number of division candidate points than the number of division candidate points determined by the determination unit are selected. A selection means;
A histogram generating means for generating a histogram of the target data using the division candidate points selected by the selecting means;
Histogram generation program characterized by functioning as
JP2010285325A 2010-12-22 2010-12-22 Histogram generation device, method and program Pending JP2012133608A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010285325A JP2012133608A (en) 2010-12-22 2010-12-22 Histogram generation device, method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010285325A JP2012133608A (en) 2010-12-22 2010-12-22 Histogram generation device, method and program

Publications (1)

Publication Number Publication Date
JP2012133608A true JP2012133608A (en) 2012-07-12

Family

ID=46649131

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010285325A Pending JP2012133608A (en) 2010-12-22 2010-12-22 Histogram generation device, method and program

Country Status (1)

Country Link
JP (1) JP2012133608A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016091491A (en) * 2014-11-11 2016-05-23 株式会社日立システムズ Information processor, compression method, and program
JP2016126646A (en) * 2015-01-07 2016-07-11 Kddi株式会社 Data processing device, data processing method, and large scale data processing program
JPWO2015145626A1 (en) * 2014-03-26 2017-04-13 株式会社日立製作所 Time-series data management method and time-series data management system
JP2018521391A (en) * 2015-05-18 2018-08-02 ゼットティーイー コーポレイション Big data calculation method and system, program and recording medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2015145626A1 (en) * 2014-03-26 2017-04-13 株式会社日立製作所 Time-series data management method and time-series data management system
JP2016091491A (en) * 2014-11-11 2016-05-23 株式会社日立システムズ Information processor, compression method, and program
JP2016126646A (en) * 2015-01-07 2016-07-11 Kddi株式会社 Data processing device, data processing method, and large scale data processing program
JP2018521391A (en) * 2015-05-18 2018-08-02 ゼットティーイー コーポレイション Big data calculation method and system, program and recording medium

Similar Documents

Publication Publication Date Title
US20180260438A1 (en) Processing records in dynamic ranges
CN103608812A (en) Query optimization techniques for business intelligence systems
US11037096B2 (en) Delivery prediction with degree of delivery reliability
KR20210135535A (en) Placement of Adaptive Aggregation Operators and Attributes in Query Plans
JP2002328937A (en) Analysis method of a large amount of accumulated data
US20060184474A1 (en) Data analysis apparatus, data analysis program, and data analysis method
US20070027843A1 (en) Separating uploads into aggregate and raw data storage
JP5588811B2 (en) Data analysis support system and method
JP2012133608A (en) Histogram generation device, method and program
JP2017146888A (en) Design support device and method and program
JP2001117947A (en) Method for sorting high dimensional data, sort tree formed by the method and computer system
US20150213107A1 (en) Apparatus of managing data and method for managing data for supporting mixed workload
US20150134660A1 (en) Data clustering system and method
KR102345410B1 (en) Big data intelligent collecting method and device
JP5716966B2 (en) Data analysis apparatus, data analysis method and program
US10628442B1 (en) Histograms based on varying data distribution
US20130218916A1 (en) File management apparatus, file management method, and file management system
CN108241622B (en) Query script generation method and device
JP6393411B2 (en) Data analysis support system and data analysis support method
WO2007089378A2 (en) Apparatus and method for forecasting control chart data
JP2007200167A (en) Patent analysis system and patent analysis program
US10719242B2 (en) Report preparation program and report preparation method
Astuti et al. Implementation of Fuzzy C-Means Algorithm with Optimized Parameter Grid for Clustering Electronic Product Sales
CN109344216A (en) A kind of k nearest neighbor Connection inquiring method towards big data
Baysal et al. Machine Learning with Distributed Data Management and Process Architecture