Abstract
Hierarchical and graph data structures are common in practical application development. In order to query such data, one can use SQL:1999 recursive queries based on Common Table Expressions. Nowadays, numerous relational database management systems implement them. However, some popular systems, e.g. MySQL, still lack this useful feature. In this paper we show three methods to circumvent this situation: (1) the direct loop, (2) horizontal unrolling and (3) vertical unrolling. We analyze them and present a report on tests of their efficiency. We also describe our implementation of these methods as a prototype extension to Hibernate, a major object-relational mapping system. This extension allows running SQL:1999 recursive queries directly from an application code, even when the underlying DBMS does not support them.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Brandon, D.: Recursive database structures. J. Comput. Small Coll. 21(2), 295–304 (2005)
Przymus, P., Boniewicz, A., Burzańska, M., Stencel, K.: Recursive Query Facilities in Relational Databases: A Survey. In: Zhang, Y., Cuzzocrea, A., Ma, J., Chung, K.-I., Arslan, T., Song, X. (eds.) DTA/BSBT 2010. CCIS, vol. 118, pp. 89–99. Springer, Heidelberg (2010)
Ghazal, A., Crolotte, A., Seid, D.Y.: Recursive SQL Query Optimization with k-Iteration Lookahead. In: Bressan, S., Küng, J., Wagner, R. (eds.) DEXA 2006. LNCS, vol. 4080, pp. 348–357. Springer, Heidelberg (2006)
Ordonez, C.: Optimization of Linear Recursive Queries in SQL. IEEE Trans. Knowl. Data Eng., 264–277 (2010)
Burzańska, M., Stencel, K., Wiśniewski, P.: Pushing Predicates into Recursive SQL Common Table Expressions. In: Grundspenkis, J., Morzy, T., Vossen, G. (eds.) ADBIS 2009. LNCS, vol. 5739, pp. 194–205. Springer, Heidelberg (2009)
Melnik, S., Adya, A., Bernstein, P.A.: Compiling mappings to bridge applications and databases. ACM Transactions on Database Systems (TODS), 33(4), 1–50 (2008)
Keller, W.: Mapping objects to tables: A pattern language. In: EuroPLoP (2007)
O’Neil, E.J.: Object/relational mapping 2008: Hibernate and the entity data model (EDM). In: Proc. ACM SIGMOD, pp. 1351–1356 (2008)
Bauer, C., King, G.: Java Persistence with Hibernate. Manning Publications Co., Greenwich (2006)
Burzańska, M., Stencel, K., Suchomska, P., Szumowska, A., Wiśniewski, P.: Recursive Queries Using Object Relational Mapping. In: Kim, T.-H., Lee, Y.-H., Kang, B.-H., Ślęzak, D. (eds.) FGIT 2010. LNCS, vol. 6485, pp. 42–50. Springer, Heidelberg (2010)
Burzańska, M., Boniewicz, A., Szumowska, A., Winiewski, P.: Hibernate the Recursive Queries - Defining the Recursive Queries Using Hibernate ORM. In: ADBIS 2011, pp.190–199 (2011)
Szumowska, A., Burzańska, M., Wiśniewski, P., Stencel, K.: Efficient Implementation of Recursive Queries in Major Object Relational Mapping Systems. In: Kim, T.-H., Adeli, H., Slezak, D., Sandnes, F.E., Song, X., Chung, K.-I., Arnett, K.P. (eds.) FGIT 2011. LNCS, vol. 7105, pp. 78–89. Springer, Heidelberg (2011)
Gawarkiewicz, M., Wiśniewski, P.: Partial Aggregation Using Hibernate. In: Kim, T.-H., Adeli, H., Slezak, D., Sandnes, F.E., Song, X., Chung, K.-I., Arnett, K.P. (eds.) FGIT 2011. LNCS, vol. 7105, pp. 90–99. Springer, Heidelberg (2011)
Boniewicz, A., Gawarkiewicz, M., Wiśniewski, P.: Automatic Selection of Functional Indexes for Object Relational Mappings System. In: FGIT 2012 (2012)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Boniewicz, A., Stencel, K., Wiśniewski, P. (2012). Unrolling SQL: 1999 Recursive Queries. In: Kim, Th., Ma, J., Fang, Wc., Zhang, Y., Cuzzocrea, A. (eds) Computer Applications for Database, Education, and Ubiquitous Computing. EL DTA 2012 2012. Communications in Computer and Information Science, vol 352. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35603-2_50
Download citation
DOI: https://doi.org/10.1007/978-3-642-35603-2_50
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-35602-5
Online ISBN: 978-3-642-35603-2
eBook Packages: Computer ScienceComputer Science (R0)