skip to main content
10.1145/2882903.2882914acmconferencesArticle/Chapter ViewAbstractPublication PagesmodConference Proceedingsconference-collections
research-article

Sampling-Based Query Re-Optimization

Published:26 June 2016Publication History

ABSTRACT

Despite of decades of work, query optimizers still make mistakes on "difficult" queries because of bad cardinality estimates, often due to the interaction of multiple predicates and correlations in the data. In this paper, we propose a low-cost post-processing step that can take a plan produced by the optimizer, detect when it is likely to have made such a mistake, and take steps to fix it. Specifically, our solution is a sampling-based iterative procedure that requires almost no changes to the original query optimizer or query evaluation mechanism of the system. We show that this indeed imposes low overhead and catches cases where three widely used optimizers (PostgreSQL and two commercial systems) make large errors.

References

  1. http://arxiv.org/abs/1601.05748.Google ScholarGoogle Scholar
  2. http://www.postgresql.org/docs/9.0/static/runtime-config-query.html.Google ScholarGoogle Scholar
  3. http://www.postgresql.org/docs/9.0/static/view-pg-stats.html.Google ScholarGoogle Scholar
  4. Skewed tpc-h data generator. ftp://ftp.research.microsoft.com/users/viveknar/TPCDSkew/.Google ScholarGoogle Scholar
  5. N. Alon, P. B. Gibbons, Y. Matias, and M. Szegedy. Tracking join and self-join sizes in limited storage. In PODS, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. B. Babcock and S. Chaudhuri. Towards a robust query optimizer: A principled and practical approach. In SIGMOD, pages 119--130, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. W. Breitling. Joins, skew and histograms. http://www.centrexcc.com/Joins, Skew and Histograms.pdf.Google ScholarGoogle Scholar
  8. N. Bruno and S. Chaudhuri. Exploiting statistics on query expressions for optimization. In SIGMOD, pages 263--274, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. N. Bruno and S. Chaudhuri. To tune or not to tune? A lightweight physical design alerter. In VLDB, pages 499--510, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. N. Bruno, S. Chaudhuri, and L. Gravano. Stholes: A multidimensional workload-aware histogram. In SIGMOD, pages 211--222, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. Charikar, S. Chaudhuri, R. Motwani, and V. R. Narasayya. Towards estimation error guarantees for distinct values. In PODS, pages 268--279, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Chaudhuri. An overview of query optimization in relational systems. In PODS, pages 34--43, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Chaudhuri, V. R. Narasayya, and R. Ramamurthy. A pay-as-you-go framework for query execution feedback. PVLDB, 1(1):1141--1152, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. L. Cole and G. Graefe. Optimization of dynamic query evaluation plans. In SIGMOD, pages 150--160, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. A. Dutt and J. R. Haritsa. Plan bouquets: query processing without selectivity estimation. In SIGMOD, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. Estan and J. F. Naughton. End-biased samples for join cardinality estimation. In ICDE, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. L. Getoor, B. Taskar, and D. Koller. Selectivity estimation using probabilistic models. In SIGMOD, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. G. Graefe. The cascades framework for query optimization. IEEE Data Eng. Bull., 18(3):19--29, 1995.Google ScholarGoogle Scholar
  19. G. Graefe and K. Ward. Dynamic query evaluation plans. In SIGMOD Conference, pages 358--366, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. P. J. Haas, J. F. Naughton, S. Seshadri, and A. N. Swami. Selectivity and cost estimation for joins based on random sampling. J. Comput. Syst. Sci., 52(3):550--569, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. I. F. Ilyas, V. Markl, P. J. Haas, P. Brown, and A. Aboulnaga. CORDS: automatic discovery of correlations and soft functional dependencies. In SIGMOD, pages 647--658, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Y. E. Ioannidis. Query optimization. ACM Comput. Surv., 28(1):121--123, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Y. E. Ioannidis. The history of histograms (abridged). In VLDB, pages 19--30, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Y. E. Ioannidis, R. T. Ng, K. Shim, and T. K. Sellis. Parametric query optimization. In VLDB, pages 103--114, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. N. Kabra and D. J. DeWitt. Efficient mid-query re-optimization of sub-optimal query execution plans. In SIGMOD, pages 106--117, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. K. Karanasos, A. Balmin, M. Kutsch, F. Ozcan, V. Ercegovac, C. Xia, and J. Jackson. Dynamically optimizing queries over large scale data platforms. In SIGMOD, pages 943--954, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. R. J. Lipton, J. F. Naughton, and D. A. Schneider. Practical selectivity estimation through adaptive sampling. In SIGMOD, pages 1--11, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. G. Lohman. Is query optimization a "solved" problem? http://wp.sigmod.org/?p=1075.Google ScholarGoogle Scholar
  29. V. Markl, P. J. Haas, M. Kutsch, N. Megiddo, U. Srivastava, and T. M. Tran. Consistent selectivity estimation via maximum entropy. VLDB J., 16(1):55--76, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. V. Markl, V. Raman, D. E. Simmen, G. M. Lohman, and H. Pirahesh. Robust query processing through progressive optimization. In SIGMOD, pages 659--670, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. M. Muralikrishna and D. J. DeWitt. Equi-depth histograms for estimating selectivity factors for multi-dimensional queries. In SIGMOD, pages 28--36, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. V. Poosala and Y. E. Ioannidis. Selectivity estimation without the attribute value independence assumption. In VLDB, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. N. Reddy and J. R. Haritsa. Analyzing plan diagrams of database query optimizers. In VLDB, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. F. Rusu and A. Dobra. Sketches for size of join estimation. ACM Trans. Database Syst., 33(3), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. P. G. Selinger, M. M. Astrahan, D. D. Chamberlin, R. A. Lorie, and T. G. Price. Access path selection in a relational database management system. In SIGMOD, 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M. Stillger, G. M. Lohman, V. Markl, and M. Kandil. LEO - DB2's learning optimizer. In VLDB, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. K. Tzoumas, A. Deshpande, and C. S. Jensen. Lightweight graphical models for selectivity estimation without independence assumptions. PVLDB, 4(11):852--863, 2011.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. D. Vengerov, A. C. Menck, M. Zaıt, and S. Chakkappen. Join size estimation subject to filter conditions. PVLDB, 8(12):1530--1541, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. W. Wu, Y. Chi, H. Hacigümüs, and J. F. Naughton. Towards predicting query execution time for concurrent and dynamic database workloads. PVLDB, 6(10):925--936, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. W. Wu, Y. Chi, S. Zhu, J. Tatemura, H. Hacigümüs, and J. F. Naughton. Predicting query execution time: Are optimizer cost models really unusable? In ICDE, pages 1081--1092, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. W. Wu, X. Wu, H. Hacigümüs, and J. F. Naughton. Uncertainty aware query execution time prediction. PVLDB, 7(14):1857--1868, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Sampling-Based Query Re-Optimization

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      SIGMOD '16: Proceedings of the 2016 International Conference on Management of Data
      June 2016
      2300 pages
      ISBN:9781450335317
      DOI:10.1145/2882903

      Copyright © 2016 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 26 June 2016

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate785of4,003submissions,20%

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader