skip to main content
10.1145/872757.872803acmconferencesArticle/Chapter ViewAbstractPublication PagesmodConference Proceedingsconference-collections
Article

Estimating compilation time of a query optimizer

Published: 09 June 2003 Publication History

Abstract

A query optimizer compares alternative plans in its search space to find the best plan for a given query. Depending on the search space and the enumeration algorithm, optimizers vary in their compilation time and the quality of the execution plan they can generate. This paper describes a compilation time estimator that provides a quantified estimate of the optimizer compilation time for a given query. Such an estimator is useful for automatically choosing the right level of optimization in commercial database systems. In addition, compilation time estimates can be quite helpful for mid-query reoptimization, for monitoring the progress of workload analysis tools where a large number queries need to be compiled (but not executed), and for judicious design and tuning of an optimizer.Previous attempts to estimate optimizer compilation complexity used the number of possible binary joins as the metric and overlooked the fact that each join often translates into a different number of join plans because of the presence of "physical" properties. We use the number of plans (instead of joins) to estimate query compilation time, and employ two novel ideas: (1) reusing an optimizer's join enumerator to obtain actual number of joins, but bypassing plan generation to save estimation overhead; (2) maintaining a small number of "interesting" properties to facilitate plan counting. We prototyped our approach in a commercial database system and our experimental results show that we can achieve good compilation time estimates (less than 30% error, on average) for complex real queries, using a small fraction (within 3%) of the actual compilation time.

References

[1]
Sanjay Agrawal, Surajit Chaudhuri, and Vivek R. Narasayya. Automated selection of materialized views and indexes in SQL databases. In VLDB, 2000.
[2]
C. Baru, et al. DB2 parallel edition database systems: The future of high performance database systems. IBM Systems Journal, 34(2), 1995.
[3]
TPC benchmark H (decision support) revision 1.1.0. http://www.tpc.org/.
[4]
Surajit Chaudhuri and Vivek Narasayya. Microsoft index tuning wizard for SQL Server 7.0. SIGMOD Record, 27(2), 1998.
[5]
Surajit Chaudhuri and Kyuseok Shim. Optimization of queries with user-defined predicates. TODS, 24(2), 1999.
[6]
IBM Corporation. DB2 Universal Database enterprise edition Version 8.1. 2002.
[7]
César A. Galindo-Legaria, Arjan Pellenkoft, and Martin L. Kersten. Uniformly-distributed random generation of join orders. In ICDT, 1995.
[8]
César A. Galindo-Legaria and Arnon Rosenthal. Outerjoin simplification and reordering for query optimization. TODS, 22(1), 1997.
[9]
Sumit Ganguly, Waqar Hasan, and Ravi Krishnamurthy. Query optimization for parallel execution. In ACM SIGMOD, 1992.
[10]
G. Graefe and W. J. McKenna. The volcano optimizer generator: Extensibility and efficient search. In ICDE, 1993.
[11]
Goetz Graefe and David J. DeWitt. The exodus optimizer generator. In ACM SIGMOD, 1987.
[12]
Yannis E. Ioannidis and Younkyung Cha Kang. Left-deep vs. bushy trees: An analysis of strategy spaces and its implications for query optimization. In ACM SIGMOD, 1991.
[13]
Mark Jerrum. Counting trees in a graph is #P-complete. Information Processing Letters, 51(3), 1994.
[14]
Vanja Josifovski, Peter M. Schwarz, Laura M. Haas, and Eileen Lin. Garlic: A new flavor of federated query processing for DB2. In ACM SIGMOD, 2002.
[15]
Navin Kabra and David J. DeWitt. Efficient mid-query re-optimization of sub-optimal query execution plans. In ACM SIGMOD, 1998.
[16]
Guy M. Lohman. Grammar-like functional rules for representing query optimization alternatives. In ACM SIGMOD, 1988.
[17]
K. Ono and G. Lohman. Measuring the complexity of join enumeration in relational query optimization. In VLDB, 1990.
[18]
Jun Rao, Chun Zhang, Nimrod Megiddo, and Guy Lohman. Automating physical database design in a parallel database. In ACM SIGMOD, 2002.
[19]
Arnon Rosenthal, Umershwar Dayal, and David Reiner. Speeding a query optimizer: the pilot pass approach. unpublished manuscript.
[20]
P. G. Selinger, M. M. Astrahan, D. D. Chamberlin, R. A. Lorie, and T. G. Price. Access path election in a relational database management system. In ACM SIGMOD, 1979.
[21]
David E. Simmen, Eugene J. Shekita, and Timothy Malkemus. Fundamental techniques for order optimization. In ACM SIGMOD, 1996.
[22]
G. Valentin, M. Zuliani, D. Zilio, G. Lohman, and A. Skelley. DB2 advisor: An optimizer smart enough to recommend its own indexes. In ICDE, 2000.
[23]
Florian Waas and César A. Galindo-Legaria. Counting, enumerating, and sampling of execution plans in a cost-based query optimizer. In ACM SIGMOD, 2000.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SIGMOD '03: Proceedings of the 2003 ACM SIGMOD international conference on Management of data
June 2003
702 pages
ISBN:158113634X
DOI:10.1145/872757
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: 09 June 2003

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Conference

SIGMOD/PODS03
Sponsor:

Acceptance Rates

SIGMOD '03 Paper Acceptance Rate 53 of 342 submissions, 15%;
Overall Acceptance Rate 785 of 4,003 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)5
  • Downloads (Last 6 weeks)1
Reflects downloads up to 24 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media