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(n 3) 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(n 2) 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(n 2) and O(n 2 log n), respectively.
C. Galindo-Legaria was supported by an ERCIM postdoctoral fellowship.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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.
S. Ceri and G. Pelagatti. Distributed Databases: Principles and Systems. McGraw-Hill, New York, 1985.
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.
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.
G. Graefe. Query evaluation techniques for large databases. ACM Computing Surveys, 25(2):73–170, June 1993.
F. Harary and E. M. Palmer. Graphical Enumeration. Academic Press, 1973.
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.
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.
Y. C. Kang. Randomized Algorithms for Query Optimization. PhD thesis, University of Wisconsin-Madison, 1991. Technical report #1053.
D. E. Knuth. The Art of Computer Programming, volume 1: Fundamental Algorithms. Addison-Wesley, 1968. Second edition, 1973.
W. Kim, D. S. Reiner, and D. S. Batory, editors. Query processing in database systems. Springer, Berlin, 1985.
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.
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.
F. Ruskey and T. C. Hu. Generating binary trees lexicographically. SIAM journal of Computation, 6(4):745–758, December 1977.
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.
A. N. Swami. Optimization of Large Join Queries. PhD thesis, Stanford University, 1989. Technical report STAN-CS-89-1262.
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.
A. N. Swami. Distribution of query plan costs for large join queries. Technical Report RJ 7908, IBM Research Division, Almaden, 1991.
J. D. Ullman. Principles of Database Systems. Computer Science Press, Rockville, MD, 2nd edition, 1982.
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.
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.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1995 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Galindo-Legaria, C.A., Pellenkoft, A., Kersten, M.L. (1995). Uniformly-distributed random generation of join orders. In: Gottlob, G., Vardi, M.Y. (eds) Database Theory — ICDT '95. ICDT 1995. Lecture Notes in Computer Science, vol 893. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-58907-4_22
Download citation
DOI: https://doi.org/10.1007/3-540-58907-4_22
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-58907-5
Online ISBN: 978-3-540-49136-1
eBook Packages: Springer Book Archive