On the power of magic

C Beeri, R Ramakrishnan - Proceedings of the sixth ACM SIGACT …, 1987 - dl.acm.org
Proceedings of the sixth ACM SIGACT-SIGMOD-SIGART symposium on Principles of …, 1987dl.acm.org
This paper considers the efficient evaluation of recursive queries expressed using Horn
Clauses. We define sideways information passing formally and show how a query
evaluation algorithm may be defined in terms of sideways information passing and control.
We then consider a class of information passing strategies which suffices to describe most
query evaluation algorithms in the database literature, and show that these strategies may
always be implemented by rewriting a given program and evaluating the rewritten program …
This paper considers the efficient evaluation of recursive queries expressed using Horn Clauses. We define sideways information passing formally and show how a query evaluation algorithm may be defined in terms of sideways information passing and control. We then consider a class of information passing strategies which suffices to describe most query evaluation algorithms in the database literature, and show that these strategies may always be implemented by rewriting a given program and evaluating the rewritten program bottom-up. We describe in detail several algorithms for rewriting a program. These algorithms generalize the Counting and Magic Sets algorithms to work with arbitrary programs. Safety and optimality of the algorithms are also considered.
ACM Digital Library