Pushing Predicates into Recursive SQL Common Table Expressions

  • Authors:
  • Marta Burzańska;Krzysztof Stencel;Piotr Wiśniewski

  • Affiliations:
  • Faculty of Mathematics and Computer Science, Nicolaus Copernicus University, Toruń, Poland;Faculty of Mathematics and Computer Science, Nicolaus Copernicus University, Toruń, Poland;Faculty of Mathematics and Computer Science, Nicolaus Copernicus University, Toruń, Poland

  • Venue:
  • ADBIS '09 Proceedings of the 13th East European Conference on Advances in Databases and Information Systems
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

A recursive SQL-1999 query consists of a recursive CTE (Common Table Expression) and a query which uses it. If such a recursive query is used in a context of a selection predicate, this predicate can possibly be pushed into the CTE thus limiting the breadth and/or depth of the recursive search. This can happen e.g. after the definition of a view containing recursive query has been expanded in place. In this paper we propose a method of pushing predicates and other query operators into a CTE. This allows executing the query with smaller temporary data structures, since query operators external w.r.t. the CTE can be computed on the fly together with the CTE. Our method is inspired on the deforestation (a.k.a. program fusion) successfully applied in functional programming languages.