Workload-Driven Antijoin Cardinality Estimation

Antijoin cardinality estimation is among a handful of problems that has eluded accurate efficient solutions amenable to implementation in relational query optimizers. Given the widespread use of antijoin and subset-based queries in analytical workloads and the extensive research targeted at join cardinality estimation—a seemingly related problem—the lack of adequate solutions for antijoin cardinality estimation is intriguing. In this article, we introduce a novel sampling-based estimator for antijoin cardinality that (unlike existent estimators) provides sufficient accuracy and efficiency to be implemented in a query optimizer. The proposed estimator incorporates three novel ideas. First, we use prior workload information when learning a mixture superpopulation model of the data offline. Second, we design a Bayesian statistics framework that updates the superpopulation model according to the live queries, thus allowing the estimator to adapt dynamically to the online workload. Third, we develop an efficient algorithm for sampling from a hypergeometric distribution in order to generate Monte Carlo trials, without explicitly instantiating either the population or the sample. When put together, these ideas form the basis of an efficient antijoin cardinality estimator satisfying the strict requirements of a query optimizer, as shown by the extensive experimental results over synthetically-generated as well as massive TPC-H data.

[1]  Chris Jermaine,et al.  Online Estimation For Subset-Based SQL Queries , 2005, VLDB.

[2]  Julien I.E. Hoffman,et al.  Binomial and Multinomial Distributions , 2015 .

[3]  Jeff A. Bilmes,et al.  A gentle tutorial of the em algorithm and its application to parameter estimation for Gaussian mixture and hidden Markov models , 1998 .

[4]  Surajit Chaudhuri,et al.  Self-tuning histograms: building histograms without looking at data , 1999, SIGMOD '99.

[5]  Volker Markl,et al.  LEO: An autonomic query optimizer for DB2 , 2003, IBM Syst. J..

[6]  Peter J. Haas,et al.  Improved histograms for selectivity estimation of range predicates , 1996, SIGMOD '96.

[7]  Yossi Matias,et al.  Bifocal sampling for skew-resistant join size estimation , 1996, SIGMOD '96.

[8]  Dan Suciu,et al.  Consistent Histograms In The Presence of Distinct Value Counts , 2009, Proc. VLDB Endow..

[9]  Peter J. Haas,et al.  Sequential sampling procedures for query size estimation , 1992, SIGMOD '92.

[10]  D. Rubin,et al.  Maximum likelihood from incomplete data via the EM - algorithm plus discussions on the paper , 1977 .

[11]  Goetz Graefe The Cascades Framework for Query Optimization , 1995, IEEE Data Eng. Bull..

[12]  Rajeev Motwani,et al.  On random sampling over joins , 1999, SIGMOD '99.

[13]  Stavros Christodoulakis,et al.  Optimal histograms for limiting worst-case error propagation in the size of join results , 1993, TODS.

[14]  Phillip B. Gibbons Distinct Sampling for Highly-Accurate Answers to Distinct Values Queries and Event Reports , 2001, VLDB.

[15]  Carlo Zaniolo,et al.  The analytical bootstrap: a new method for fast error estimation in approximate query processing , 2014, SIGMOD Conference.

[16]  Wen-Chi Hou,et al.  CS2: a new database synopsis for query estimation , 2013, SIGMOD '13.

[17]  O. Vorobyev,et al.  Discrete multivariate distributions , 2008, 0811.0406.

[18]  Chris Jermaine,et al.  Sampling-based estimators for subset-based queries , 2008, The VLDB Journal.

[19]  Chris Jermaine,et al.  Relational confidence bounds are easy with the bootstrap , 2005, SIGMOD '05.

[20]  Gerhard Weikum,et al.  ACM Transactions on Database Systems , 2005 .

[21]  Arun N. Swami,et al.  On the Estimation of Join Result Sizes , 1994, EDBT.

[22]  David J. DeWitt,et al.  Proactive re-optimization , 2005, SIGMOD '05.

[23]  Ameet Talwalkar,et al.  Knowing when you're wrong: building fast and reliable approximate query processing systems , 2014, SIGMOD Conference.

[24]  Guy M. Lohman,et al.  Is query optimization a 'solved' problem? , 1989 .

[25]  Neoklis Polyzotis,et al.  TuG synopses for approximate query answering , 2009, TODS.

[26]  Fei Xu,et al.  Turbo-Charging Estimate Convergence in DBO , 2009, Proc. VLDB Endow..

[27]  Raghu Ramakrishnan,et al.  Synopses for query optimization: A space-complexity perspective , 2004, TODS.

[28]  Peter J. Haas,et al.  ISOMER: Consistent Histogram Construction Using Query Feedback , 2006, 22nd International Conference on Data Engineering (ICDE'06).

[29]  Jeffrey F. Naughton,et al.  Sampling-Based Estimation of the Number of Distinct Values of an Attribute , 1995, VLDB.

[30]  Christian P. Robert,et al.  Monte Carlo Statistical Methods (Springer Texts in Statistics) , 2005 .

[31]  Evaggelia Pitoura Query Optimization , 2009, Encyclopedia of Database Systems.

[32]  Christian P. Robert,et al.  Monte Carlo Statistical Methods , 2005, Springer Texts in Statistics.

[33]  John K Kruschke,et al.  Bayesian data analysis. , 2010, Wiley interdisciplinary reviews. Cognitive science.

[34]  Hamid Pirahesh,et al.  Robust query processing through progressive optimization , 2004, SIGMOD '04.

[35]  D. Hunter,et al.  mixtools: An R Package for Analyzing Mixture Models , 2009 .

[36]  Patricia G. Selinger,et al.  Access path selection in a relational database management system , 1979, SIGMOD '79.

[37]  Yannis E. Ioannidis,et al.  The History of Histograms (abridged) , 2003, VLDB.

[38]  Volker Markl,et al.  LEO - DB2's LEarning Optimizer , 2001, VLDB.

[39]  Peter J. Haas,et al.  Discovering and Exploiting Statistical Properties for Query Optimization in Relational Databases: A Survey , 2009, Stat. Anal. Data Min..

[40]  KabraNavin,et al.  Efficient mid-query re-optimization of sub-optimal query execution plans , 1998 .

[41]  Guido Moerkotte,et al.  Preventing Bad Plans by Bounding the Impact of Cardinality Estimation Errors , 2009, Proc. VLDB Endow..

[42]  Surajit Chaudhuri,et al.  An overview of query optimization in relational systems , 1998, PODS.

[43]  Sridhar Ramaswamy,et al.  Join synopses for approximate query answering , 1999, SIGMOD '99.

[44]  Luis Gravano,et al.  STHoles: a multidimensional workload-aware histogram , 2001, SIGMOD '01.

[45]  David R. Hunter,et al.  mixtools: An R Package for Analyzing Mixture Models , 2009 .