Random sampling for histogram construction
- 1 June 1998
- journal article
- Published by Association for Computing Machinery (ACM) in ACM SIGMOD Record
- Vol. 27 (2) , 436-447
- https://doi.org/10.1145/276305.276343
Abstract
Random sampling is a standard technique for constructing (approximate) histograms for query optimization. However, any real implementation in commercial products requires solving the hard problem of determining “How much sampling is enough?” We address this critical question in the context of equi-height histograms used in many commercial products, including Microsoft SQL Server. We introduce a conservative error metric capturing the intuition that for an approximate histogram to have low error, the error must be small in all regions of the histogram. We then present a result establishing an optimal bound on the amount of sampling required for pre-specified error bounds. We also describe an adaptive page sampling algorithm which achieves greater efficiency by using all values in a sampled page but adjusts the amount of sampling depending on clustering of values in pages. Next, we establish that the problem of estimating the number of distinct values is provably difficult, but propose a new error metric which has a reliable estimator and can still be exploited by query optimizers to influence the choice of execution plans. The algorithm for histogram construction was prototyped on Microsoft SQL Server 7.0 and we present experimental results showing that the adaptive algorithm accurately approximates the true histogram over different data distributions.Keywords
This publication has 17 references indexed in Scilit:
- Improved histograms for selectivity estimation of range predicatesPublished by Association for Computing Machinery (ACM) ,1996
- Efficient sampling strategies for relational database operationsTheoretical Computer Science, 1993
- On Estimating COUNT, SUM, and AVERAGE Relational Algebra QueriesPublished by Springer Nature ,1991
- Statistical estimators for relational algebra expressionsPublished by Association for Computing Machinery (ACM) ,1988
- Physical database design for relational databasesACM Transactions on Database Systems, 1988
- Accurate estimation of the number of tuples satisfying a conditionPublished by Association for Computing Machinery (ACM) ,1984
- Robust Estimation of Population Size When Capture Probabilities Vary Among AnimalsEcology, 1979
- Access path selection in a relational database management systemPublished by Association for Computing Machinery (ACM) ,1979
- Estimation of the size of a closed population when capture probabilities vary among animalsBiometrika, 1978
- On the Estimation of the Number of Classes in a PopulationThe Annals of Mathematical Statistics, 1949