|
ABSTRACT
The magic-sets transformation is a useful technique for dramatically improving the performance of complex queries, but it has been observed that this transformation can also drastically reduce the performance of some queries. Successful implementations of magic in previous work require integration with the database optimiser to make appropriate decisions to guide the transformation (the sideways information passing strategy, or SIPS). This paper reports on the addition of the magic-sets transformation to a fully automatic optimising compiler from Datalog to SQL with no support from the database optimiser. We present an algorithm for making a good choice of SIPS using heuristics based on the sizes of relations. To achieve this, we define an abstract interpretation of Datalog programs to estimate the sizes of relations in the program. The effectiveness of our technique is evaluated over a substantial set of over a hundred queries, and in the context of the other optimisations performed by our compiler. It is shown that using the SIPS chosen by our algorithm, query performance is often significantly improved, as expected, but more importantly performance is never significantly degraded on queries that cannot benefit from magic.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
| |
2
|
François Bancilhon, David Maier, Yehoshua Sagiv, and Jeffrey D. Ullman. Magic sets and other strange ways to implement logic programs. In SIGMOD Conference, pages 1--16. ACM, 1986.
|
 |
3
|
|
 |
4
|
|
 |
5
|
|
| |
6
|
Oege de Moor, Damien Sereni, Mathieu Verbaere, Elnar Hajiyev, Pavel Avgustinov, Torbjörn Ekman, Neil Ongkingco, and Julian Tibble. .QL: Object-oriented queries made easy. In Generative and Transformational Techniques for Software Engineering (GTTSE '07), 2007.
|
| |
7
|
Jack Edmonds. Optimum branchings. Journal of Research of the National Bureau of Standards -- B. Mathematics and Mathematical Physics, 71B(4):233--240, October-December 1967.
|
| |
8
|
|
| |
9
|
|
| |
10
|
H2 Database Engine. Website with documentation and downloads. http://www.h2database.com, 2007.
|
| |
11
|
Elnar Hajiyev, Mathieu Verbaere, and Oege de Moor. CodeQuest: scalable source code queries with Datalog. In Proceedings of ECOOP, volume 4067 of LNCS, pages 2--27. Springer, 2006.
|
| |
12
|
Jakob Henriksson and Jan Małuszy\’nski. Static type-checking of datalog with ontologies. In Principles and Practice of Web Reasoning, volume 3208 of LNCS, pages 76--89, 2004.
|
| |
13
|
JFreeChart. Website with documentation and downloads. http://www.jfree.org/jfreechart/, 2007.
|
| |
14
|
|
 |
15
|
Monica S. Lam , John Whaley , V. Benjamin Livshits , Michael C. Martin , Dzintars Avots , Michael Carbin , Christopher Unkel, Context-sensitive program analysis as database queries, Proceedings of the twenty-fourth ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, June 13-15, 2005, Baltimore, Maryland
[doi> 10.1145/1065167.1065169]
|
| |
16
|
|
| |
17
|
Microsoft. SQL server website with documentation and downloads. http://www.microsoft.com/sql, 2007.
|
 |
18
|
|
 |
19
|
I. S. Mumick , S. J. Finkelstein , Hamid Pirahesh , Raghu Ramakrishnan, Magic is relevant, Proceedings of the 1990 ACM SIGMOD international conference on Management of data, p.247-258, May 23-26, 1990, Atlantic City, New Jersey, United States
|
 |
20
|
|
| |
21
|
PostgreSQL. Documentation and downloads. http://www.postgresql.org, 2007.
|
| |
22
|
|
| |
23
|
Semmle Ltd. Collection of .QL queries used in benchmarks, 2007. http://semmle.com/benchmarks/defaultqueries.tar.gz.
|
| |
24
|
Semmle Ltd. Company website with free downloads, documentation, and discussion forums. http://semmle.com, 2007.
|
| |
25
|
Semmle Ltd. Database schema with annotations, 2007. http://semmle.com/benchmarks/semmlecode.dbscheme.
|
 |
26
|
Praveen Seshadri , Joseph M. Hellerstein , Hamid Pirahesh , T. Y. Cliff Leung , Raghu Ramakrishnan , Divesh Srivastava , Peter J. Stuckey , S. Sudarshan, Cost-based optimization for magic: algebra and implementation, Proceedings of the 1996 ACM SIGMOD international conference on Management of data, p.435-446, June 04-06, 1996, Montreal, Quebec, Canada
|
 |
27
|
|
| |
28
|
John Whaley, Dzintars Avots, Michael Carbin, and Monica S. Lam. Using datalog and binary decision diagrams for program analysis. In Proceedings of APLAS, volume 3780 of LNCS, pages 97--118. Springer, 2005.
|
|