Uniformly-distributed random generation of join orders

  • César A. Galindo-Legaria
  • Arjan Pellenkoft
  • Martin L. Kersten
Contributed Papers Probabilistic Methods
Part of the Lecture Notes in Computer Science book series (LNCS, volume 893)

Abstract

In this paper we study the space of operator trees that can be used to answer a join query, with the goal of generating elements form this space at random. We solve the problem for queries with acyclic query graphs. We first count, in O(n3) time, the exact number of trees that can be used to evaluate a given query on n relations. The intermediate results of the counting procedure then serve to generate random, uniformly distributed operator trees in O(n2) time per tree. We also establish a mapping between the N operator trees for a query and the integers 1 through N —i. e. a ranking-and describe ranking and unranking procedures with complexity O(n2) and O(n2 log n), respectively.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [BFMY83]
    C. Beeri, R. Fagin, D. Maier, and M. Yannakakis. On the desirability of acyclic database schemes. Journal of the ACM, 30(3):479–513, July 1983.Google Scholar
  2. [CP85]
    S. Ceri and G. Pelagatti. Distributed Databases: Principles and Systems. McGraw-Hill, New York, 1985.Google Scholar
  3. [GLPK94]
    C. A. Galindo-Legaria, A. Pellenkoft, and M. L. Kersten. Fast, randomized join-order selection —Why use transformations? In Proceedings of the Twentieth International Conference on Very Large Databases, Santiago, 1994. Also CWI Technical Report CS-R9416.Google Scholar
  4. [GLW82]
    U. Gupta, D. T. Lee, and C. K. Wong. Ranking and unranking of 2–3 trees. SIAM Journal of Computation, pages 582–590, August 1982.Google Scholar
  5. [Gra93]
    G. Graefe. Query evaluation techniques for large databases. ACM Computing Surveys, 25(2):73–170, June 1993.Google Scholar
  6. [HP73]
    F. Harary and E. M. Palmer. Graphical Enumeration. Academic Press, 1973.Google Scholar
  7. [IK90]
    Y. E. Ioannidis and Y. C. Kang. Randomized algorithms for optimizing large join queries. Proc. of the ACM-SIGMOD Conference on Management of Data, pages 312–321, 1990.Google Scholar
  8. [IK91]
    Y. E. Ioannidis and Y. C. Kang. Left-deep vs. bushy trees: An analysis of strategy spaces and its implications for query optimization. Proc. of the ACM-SIGMOD Conference on Management of Data, pages 168–177, 1991.Google Scholar
  9. [Kan91]
    Y. C. Kang. Randomized Algorithms for Query Optimization. PhD thesis, University of Wisconsin-Madison, 1991. Technical report #1053.Google Scholar
  10. [Knu68]
    D. E. Knuth. The Art of Computer Programming, volume 1: Fundamental Algorithms. Addison-Wesley, 1968. Second edition, 1973.Google Scholar
  11. [KRB85]
    W. Kim, D. S. Reiner, and D. S. Batory, editors. Query processing in database systems. Springer, Berlin, 1985.Google Scholar
  12. [LVZ93]
    R. S. G. Lanzelotte, P. Valduriez, and M. Zaït. On the effectiveness of optimization search strategies for parallel execution spaces. Proc. of the 19th VLDB Conference, Dublin, Ireland, pages 493–504, 1993.Google Scholar
  13. [OL90]
    K. Ono and G. M. Lohman. Measuring the complexity of join enumeration in query optimization. Proc. of the 16th VLDB Conference, Brisbane, Australia, pages 314–325, 1990.Google Scholar
  14. [RH77]
    F. Ruskey and T. C. Hu. Generating binary trees lexicographically. SIAM journal of Computation, 6(4):745–758, December 1977.Google Scholar
  15. [SG88]
    A. N. Swami and A. Gupta. Optimization of large join queries. Proc. of the ACM-SIGMOD Conference on Management of Data, pages 8–17, 1988.Google Scholar
  16. [Swa89a]
    A. N. Swami. Optimization of Large Join Queries. PhD thesis, Stanford University, 1989. Technical report STAN-CS-89-1262.Google Scholar
  17. [Swa89b]
    A. N. Swami. Optimization of large join queries: Combining heuristics and combinatorial techniques. Proc. of the ACM-SIGMOD Conference on Management of Data, pages 367–376, 1989.Google Scholar
  18. [Swa91]
    A. N. Swami. Distribution of query plan costs for large join queries. Technical Report RJ 7908, IBM Research Division, Almaden, 1991.Google Scholar
  19. [Ull82]
    J. D. Ullman. Principles of Database Systems. Computer Science Press, Rockville, MD, 2nd edition, 1982.Google Scholar
  20. [VF90]
    J. S. Vitter and Ph. Flajolet. Analysis of algorithms and data structures. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume A: Algorithms and Complexity, chapter 9, pages 431–524. North Holland, 1990.Google Scholar
  21. [vL90]
    J. van Leeuwen. Graph algorithms. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume A: Algorithms and Complexity, chapter 10, pages 525–631. North Holland, 1990.Google Scholar

Copyright information

© Springer-Verlag 1995

Authors and Affiliations

  • César A. Galindo-Legaria
    • 1
    • 2
  • Arjan Pellenkoft
    • 1
  • Martin L. Kersten
    • 1
  1. 1.CWIGB AmsterdamThe Netherlands
  2. 2.SINTEF DELABTrondheimNorway

Personalised recommendations