Query optimization is an integral part of relational database management systems. One important task in query optimization is selectivity estimation, that is, given a query P, we need to estimate the fraction of records in the database that satisfy P. Many commercial database systems maintain histograms to approximate the frequency distribution of values in the attributes of relations. Several important components in a database management system (DBMS) require accurate estimation of the selectivity of a given query. For example, query optimizers use it to evaluate the costs of different query execution plans and choose the preferred one. In this paper, we present a technique based upon a multiresolution wavelet decomposition for building histograms on the underlying data distributions, with applications to databases, statistics, and simulation. Histograms built on the cumulative data distributions give very good approximations with limited space usage. We give fast algorithms for constructing histograms and using them in an on-line fashion for selectivity estimation. Our histograms also provide quick approximate answers to OLAP queries when the exact answers are not required. Our method captures the joint distribution of multiple attributes effectively, even when the attributes are correlated. Experiments confirm that our histograms offer substantial improvements in accuracy over random sampling and other previous approaches. The set of predicates we are going to consider in this paper is the set of selection queries, in particular, range predicates of the form a < X < b, where X is a nonnegative attribute of the domain of a relation R and a and b are constants. The set of equal predicates is the subset of the range predicates that have a = b. The set of one-side range predicates is the special case of range predicates in which a = -oc or b = cm. (We take se = v1 and sn = 1.) The frequency fi of vi is the number of tuples in which X has value vi. The cumulative frequency ci of vi is the number of tuples t E R with t.X 5 vi; that is, ci = '&r fj. The data distribution of X is the set of pairs 7 = {(VI, fr ),
Matias et al. REF first proposed the use of Haar-wavelet coefficients as synopses for accurately estimating the selectivities of range queries.
Wavelet-based histograms for selectivity estimation
SIGMOD '98
Computer Science