Elamur Research

Query Optimization Through the Looking Glass, and What We Found Running the Join Order Benchmark

Paper · 2018 · Viktor Leis, Bernhard Radke, Andrey Gubichev et al.

Summary

The paper asks which part of a classical cost-based query optimizer matters most for picking good join orders: cardinality estimation, the cost model, or plan enumeration. The authors argue that synthetic benchmarks such as TPC-H, TPC-DS and SSB hide the difficulty because their data generators assume uniformity and independence. They therefore built the Join Order Benchmark (JOB) on a real IMDB snapshot, which is full of correlations. Using PostgreSQL, they inject and extract cardinality estimates, which lets them compare the estimators of several commercial systems on the same basis and measure the effect of perfect estimates. All tested estimators often made large errors on multi-join queries, mostly underestimating results as the number of joins grew. These errors affected plan quality far more than cost-model inaccuracies. Exhaustive enumeration still outperformed heuristics. The study matters because it offers a realistic, public workload and evidence-based design priorities for optimizers: robust handling of uncertain estimates, and research effort aimed at join-crossing correlations.

Key points

  • JOB workload: 113 queries built from 33 query structures, each with 2–6 variants that differ only in their selections. Queries contain 3–16 joins, about 8 on average.
  • Data set: a May 2013 IMDB snapshot with 21 tables, about 3.6 GB as CSV, loaded with the imdbpy package.
  • Cost model matters less than estimates: in main memory, a trivial cost model that only adds up estimated intermediate tuple counts performed as well as PostgreSQL's tuned cost model.
  • Plan enumeration and indexes: exhaustive dynamic programming beat heuristics such as QuickPick, GOO and BSizePP. Zig-zag trees beat left-deep trees, which beat right-deep trees. Adding foreign-key indexes made bad estimates much more costly.
  • Disk-based processing: accurate estimation remains the top priority, but modeling random versus sequential I/O also helps predict runtime. Hash joins are recommended as the robust default.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

 Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksHardware and Architecture · 183 worksSignal Processing · 499 worksComputer Networks and Communications · 115 works

 Topics 1Research subjects and languages the work is about.Evaluation & benchmarks · 1,394 works

Cite

Cite as Viktor Leis, Bernhard Radke, Andrey Gubichev, Atanas Mirchev, Peter Boncz, Alfons Kemper and Thomas Neumann. 2018. Query Optimization Through the Looking Glass, and What We Found Running the Join Order Benchmark. VLDB Journal 27.

The paper itself, not this page. BibTeX from the library's record of the work.

@article{leis2018query,
  title = {{Query Optimization Through the Looking Glass, and What We Found Running the Join Order Benchmark}},
  author = {Viktor Leis, Bernhard Radke, Andrey Gubichev, Atanas Mirchev, Peter Boncz, Alfons Kemper and Thomas Neumann},
  journal = {VLDB Journal 27},
  year = {2018},
  doi = {10.1007/s00778-017-0480-7},
  url = {https://doi.org/10.1007/s00778-017-0480-7}
}

References

53 references, 0 of them with a card of ours. Each entry links to our card when we hold the work, else to OpenAlex and Google Scholar searches for it.

  1. Ahmed, R., Sen, R., Poess, M., Chakkappen, S.: Of snowstorms and bushy trees. PVLDB 7(13), 1452–1461 (2014) OpenAlex ↗ · Scholar ↗
  2. Babcock, B., Chaudhuri, S.: Towards a robust query optimizer: A principled and practical approach. In: SIGMOD, pp. 119–130 (2005) OpenAlex ↗ · Scholar ↗
  3. Bellamkonda, S., Li, H.G., Jagtap, U., Zhu, Y., Liang, V., Cruanes, T.: Adaptive and big data scale parallel execution in Oracle. PVLDB 6(11), 1102–1113 (2013) OpenAlex ↗ · Scholar ↗
  4. Boncz, P.A., Neumann, T., Erling, O.: TPC-H analyzed: Hidden messages and lessons learned from an influential benchmark. In: TPCTC, pp. 61–76 (2013) OpenAlex ↗ · Scholar ↗
  5. Borovica-Gajic, R., Idreos, S., Ailamaki, A., Zukowski, M., Fraser, C.: Smooth scan: Statistics-oblivious access paths. In: ICDE, pp. 315–326 (2015) OpenAlex ↗ · Scholar ↗
  6. Bruno, N., Galindo-Legaria, C.A., Joshi, M.: Polynomial heuristics for query optimization. In: ICDE, pp. 589–600 (2010) OpenAlex ↗ · Scholar ↗
  7. Chaudhuri, S.: Query optimizers: time to rethink the contract? In: SIGMOD, pp. 961–968 (2009) OpenAlex ↗ · Scholar ↗
  8. Chaudhuri, S., Narasayya, V.R., Ramamurthy, R.: Exact cardinality query optimization for optimizer testing. PVLDB 2(1), 994– 1005 (2009) OpenAlex ↗ · Scholar ↗
  9. Colgan, M.: Oracle adaptive joins. https://blogs.oracle.com/optimizer/entry/what_s_new_in_ 12c (2013) OpenAlex ↗ · Scholar ↗
  10. Dutt, A., Haritsa, J.R.: Plan bouquets: query processing without selectivity estimation. In: SIGMOD, pp. 1039–1050 (2014) OpenAlex ↗ · Scholar ↗
  11. Estan, C., Naughton, J.F.: End-biased samples for join cardinality estimation. In: ICDE, p. 20 (2006) OpenAlex ↗ · Scholar ↗
  12. Fegaras, L.: A new heuristic for optimizing large queries. In: DEXA, pp. 726–735 (1998) OpenAlex ↗ · Scholar ↗
  13. Fender, P., Moerkotte, G.: Counter strike: Generic top-down join enumeration for hypergraphs. PVLDB 6(14), 1822–1833 (2013) OpenAlex ↗ · Scholar ↗
  14. Fender, P., Moerkotte, G., Neumann, T., Leis, V.: Effective and robust pruning for top-down join enumeration algorithms. In: ICDE, pp. 414–425 (2012) OpenAlex ↗ · Scholar ↗
  15. Fraser, C., Giakoumakis, L., Hamine, V., Moore-Smith, K.F.: Testing cardinality estimation models in SQL Server. In: DBtest (2012) OpenAlex ↗ · Scholar ↗
  16. Graefe, G.: A generalized join algorithm. In: BTW, pp. 267–286 (2011) OpenAlex ↗ · Scholar ↗
  17. Gu, Z., Soliman, M.A., Waas, F.M.: Testing the accuracy of query optimizers. In: DBTest (2012) OpenAlex ↗ · Scholar ↗
  18. Haas, P.J., Naughton, J.F., Seshadri, S., Swami, A.N.: Selectivity and cost estimation for joins based on random sampling. J Computer System Science 52(3), 550–569 (1996) OpenAlex ↗ · Scholar ↗
  19. Haritsa, J.R.: The Picasso database query optimizer visualizer. PVLDB 3(2), 1517–1520 (2010) OpenAlex ↗ · Scholar ↗
  20. Ilyas, I.F., Markl, V., Haas, P.J., Brown, P., Aboulnaga, A.: CORDS: automatic discovery of correlations and soft functional dependencies. In: SIGMOD, pp. 647–658 (2004) OpenAlex ↗ · Scholar ↗
  21. Ioannidis, Y.E.: The history of histograms (abridged). In: VLDB, pp. 19–30 (2003) OpenAlex ↗ · Scholar ↗
  22. Ioannidis, Y.E., Christodoulakis, S.: On the propagation of errors in the size of join results. In: SIGMOD (1991) OpenAlex ↗ · Scholar ↗
  23. Kader, R.A., Boncz, P.A., Manegold, S., van Keulen, M.: ROX: run-time optimization of XQueries. In: SIGMOD, pp. 615–626 (2009) OpenAlex ↗ · Scholar ↗
  24. Kaushik, R., Ré, C., Suciu, D.: General database statistics using entropy maximization. In: DBPL, pp. 84–99 (2009) OpenAlex ↗ · Scholar ↗
  25. Kester, M.S., Athanassoulis, M., Idreos, S.: Access path selection in main-memory optimized data systems: Should I scan or should I probe? In: SIGMOD (2017) OpenAlex ↗ · Scholar ↗
  26. Lang, H., Mühlbauer, T., Funke, F., Boncz, P.A., Neumann, T., Kemper, A.: Data Blocks: Hybrid OLTP and OLAP on compressed storage using both vectorization and compilation. In: SIG-MOD, pp. 311–326 (2016) OpenAlex ↗ · Scholar ↗
  27. Leis, V., Boncz, P., Kemper, A., Neumann, T.: Morsel-driven parallelism: A NUMA-aware query evaluation framework for the many-core age. In: SIGMOD (2014) OpenAlex ↗ · Scholar ↗
  28. Leis, V., Gubichev, A., Mirchev, A., Boncz, P.A., Kemper, A., Neumann, T.: How good are query optimizers, really? PVLDB 9(3), 204–215 (2015) OpenAlex ↗ · Scholar ↗
  29. Leis, V., Kundhikanjana, K., Kemper, A., Neumann, T.: Efficient processing of window functions in analytical SQL queries. PVLDB 8(10) (2015) OpenAlex ↗ · Scholar ↗
  30. Leis, V., Radke, B., Gubichev, A., Kemper, A., Neumann, T.: Cardinality estimation done right: Index-based join sampling. In: CIDR (2017) OpenAlex ↗ · Scholar ↗
  31. Li, Q., Shao, M., Markl, V., Beyer, K.S., Colby, L.S., Lohman, G.M.: Adaptively reordering joins during query execution. In: ICDE, pp. 26–35 (2007) OpenAlex ↗ · Scholar ↗
  32. Liu, F., Blanas, S.: Forecasting the cost of processing multi-join queries via hashing for main-memory databases. In: SoCC, pp. 153–166 (2015) OpenAlex ↗ · Scholar ↗
  33. Lohman, G.: Is query optimization a solved problem? http://wp.sigmod.org/?p=1075 (2014) OpenAlex ↗ · Scholar ↗
  34. Mackert, L.F., Lohman, G.M.: R* optimizer validation and performance evaluation for local queries. In: SIGMOD, pp. 84–95 (1986) OpenAlex ↗ · Scholar ↗
  35. Markl, V., Megiddo, N., Kutsch, M., Tran, T.M., Haas, P.J., Srivastava, U.: Consistently estimating the selectivity of conjuncts of predicates. In: VLDB, pp. 373–384 (2005) OpenAlex ↗ · Scholar ↗
  36. Moerkotte, G., Neumann, T.: Dynamic programming strikes back. In: SIGMOD, pp. 539–552 (2008) OpenAlex ↗ · Scholar ↗
  37. Moerkotte, G., Neumann, T., Steidl, G.: Preventing bad plans by bounding the impact of cardinality estimation errors. PVLDB 2(1), 982–993 (2009) OpenAlex ↗ · Scholar ↗
  38. Müller, I., Sanders, P., Lacurie, A., Lehner, W., Färber, F.: Cache-efficient aggregation: Hashing is sorting. In: SIGMOD, pp. 1123– 1136 (2015) OpenAlex ↗ · Scholar ↗
  39. Neumann, T.: Query simplification: graceful degradation for join-order optimization. In: SIGMOD, pp. 403–414 (2009) OpenAlex ↗ · Scholar ↗
  40. Neumann, T., Galindo-Legaria, C.A.: Taking the edge off cardinality estimation errors using incremental execution. In: BTW, pp. 73–92 (2013) OpenAlex ↗ · Scholar ↗
  41. O’Neil, P.E., O’Neil, E.J., Chen, X., Revilak, S.: The star schema benchmark and augmented fact table indexing. In: TPCTC, pp. 237–252 (2009) OpenAlex ↗ · Scholar ↗
  42. Poosala, V., Ioannidis, Y.E.: Selectivity estimation without the attribute value independence assumption. In: VLDB, pp. 486–495 (1997) OpenAlex ↗ · Scholar ↗
  43. Pöss, M., Nambiar, R.O., Walrath, D.: Why you should run TPC-DS: A workload analysis. In: PVLDB, pp. 1138–1149 (2007) OpenAlex ↗ · Scholar ↗
  44. Rusu, F., Dobra, A.: Sketches for size of join estimation. TODS 33(3) (2008) OpenAlex ↗ · Scholar ↗
  45. Selinger, P.G., Astrahan, M.M., Chamberlin, D.D., Lorie, R.A., Price, T.G.: Access path selection in a relational database management system. In: SIGMOD, pp. 23–34 (1979) OpenAlex ↗ · Scholar ↗
  46. Steinbrunn, M., Moerkotte, G., Kemper, A.: Heuristic and randomized optimization for the join ordering problem. VLDB J. 6(3), 191–208 (1997) OpenAlex ↗ · Scholar ↗
  47. Stillger, M., Lohman, G.M., Markl, V., Kandil, M.: LEO - DB2’s learning optimizer. In: VLDB, pp. 19–28 (2001) OpenAlex ↗ · Scholar ↗
  48. Tzoumas, K., Deshpande, A., Jensen, C.S.: Lightweight graphical models for selectivity estimation without independence assumptions. PVLDB 4(11), 852–863 (2011) OpenAlex ↗ · Scholar ↗
  49. Waas, F., Pellenkoft, A.: Join order selection - good enough is easy. In: BNCOD, pp. 51–67 (2000) OpenAlex ↗ · Scholar ↗
  50. Waas, F.M., Giakoumakis, L., Zhang, S.: Plan space analysis: an early warning system to detect plan regressions in cost-based optimizers. In: DBTest (2011) OpenAlex ↗ · Scholar ↗
  51. Wu, W., Chi, Y., Zhu, S., Tatemura, J., Hacigümüs, H., Naughton, J.F.: Predicting query execution time: Are optimizer cost models really unusable? In: ICDE, pp. 1081–1092 (2013) OpenAlex ↗ · Scholar ↗
  52. Wu, W., Naughton, J.F., Singh, H.: Sampling-based query reoptimization. In: SIGMOD (2016) OpenAlex ↗ · Scholar ↗
  53. Yu, F., Hou, W., Luo, C., Che, D., Zhu, M.: CS2: a new database synopsis for query estimation. In: SIGMOD, pp. 469–480 (2013) OpenAlex ↗ · Scholar ↗

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/leis-2018-query-optimization-through-looking-glass/