skip to main content
10.1145/342009.335451acmconferencesArticle/Chapter ViewAbstractPublication PagesmodConference Proceedingsconference-collections
Article
Free access

Counting, enumerating, and sampling of execution plans in a cost-based query optimizer

Published: 16 May 2000 Publication History

Abstract

Testing an SQL database system by running large sets of deterministic or stochastic SQL statements is common practice in commercial database development. However, code defects often remain undetected as the query optimizer's choice of an execution plan is not only depending on the query but strongly influenced by a large number of parameters describing the database and the hardware environment. Modifying these parameters in order to steer the optimizer to select other plans is difficult since this means anticipating often complex search strategies implemented in the optimizer.
In this paper we devise algorithms for counting, exhaustive generation, and uniform sampling of plans from the complete search space. Our techniques allow extensive validation of both generation of alternatives, and execution algorithms with plans other than the optimized one—if two candidate plans fail to produce the same results, then either the optimizer considered an invalid plan, or the execution code is faulty. When the space of alternatives becomes too large for exhaustive testing, which can occur even with a handful of joins, uniform random sampling provides a mechanism for unbiased testing.
The technique is implemented in Microsoft's SQL Server, where it is an integral part of the validation and testing process.

References

[1]
J. A. Blakeley, W. J. McKenna, and G. Graefe. Experiences Building the Open OODB Query Optimizer. In Proc. of the A CM SIGMOD Int'l. Conf. on Management of Data, pages 287-296, Washington, DC, USA, May 1993.
[2]
C. A. Galindo-Legaria, A. Pellenkoft, and M. L. Kersten. Uniformly-distributed Random Generation of Join Orders. In Proc. of the Int'l. Conf. on Database Theory, pages 280-293, Prague, Czech Republic, January 1995.
[3]
G. Graefe. The Cascades Framework for Query Optimization. IEEE Data Engineering Bulletin, 18(3):19-29, September 1995.
[4]
G. Graefe and D. J. DeWitt. The EXODUS Optimizer Generator. In Proc. of the A CM SIGMOD Int'l. Conf. on Management of Data, pages 160-172, San Francisco, CA, USA, May 1987.
[5]
G. Graefe and W. J. McKenna. The Volcano Optimizer Generator: Extensibility and Efficient Search. In Proc. of the IEEE Int'l. Conf. on Data Engineering, pages 209-218, Vienna, Austria, April 1993.
[6]
Y. E. Ioannidis and Y. C. Kang. Left-Deep vs. Bushy Trees: An Analysis of Strategy Spaces and its Implications for Query Optimization. In Proc. of the A CM SIGMOD Int'l. Conf. on Management of Data, pages 168-177, Denver, CO, USA, May 1991.
[7]
W. J. McKenna. Efficient Search in Extensible Database Query Optimization: The Volcano Optimizer Generator. PhD thesis, University of Colorado, Boulder, CO, USA, 1993.
[8]
K. Ono and G. M. Lohman. Measuring the Complexity of Join Enumaration in Query Optimization. In Proc. of the Int'l. Conf. on Very Large Data Bases, pages 314-325, Brisbane, Australia, August 1990.
[9]
A. Pellenkoft, C. A. Galindo-Legaria, and M. L. Kersten. The Complexity of Transformation-Based Join Enumeration. In Proc. of the Int'l. Conf. on Very Large Data Bases, pages 306-315, Athens, Greece, September 1997.
[10]
R. Ruskey and T. C. Hu. Generating Binary Tree Lexicographically. SIAM Journal of Computation, 6(4):745-758, December 1977.
[11]
D. Slutz. Massive Stochastic Testing of SQL. In Proc. of the Int'l. Conf. on Very Large Data Bases, pages 618-622, New York, NY, USA, September 1998.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SIGMOD '00: Proceedings of the 2000 ACM SIGMOD international conference on Management of data
May 2000
604 pages
ISBN:1581132174
DOI:10.1145/342009
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 16 May 2000

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Conference

SIGMOD/PODS00
Sponsor:

Acceptance Rates

SIGMOD '00 Paper Acceptance Rate 42 of 248 submissions, 17%;
Overall Acceptance Rate 785 of 4,003 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)259
  • Downloads (Last 6 weeks)21
Reflects downloads up to 27 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media