Severalmethodshavebeenproposedto compile recursive Datalog programs. The most well-known perform a rewriting of rules using MAGIC or PROBLEM predicates in order to push selectionsbeforerecursion.Rewritten rule systemsaregenerally complex anddifficult to translateinto optimized relational algebraprograms.Moreover,theyoften generatetoo many results; thus, the query must be applied to the generatedresults to eliminate non relevant answers. In this paper, after a survey of the existing compilation techniqueswhich points out their limitations, we develop the magic function method iutroduced in [GardariuDeMaindreville86]. It is basedon an understandingof the query as a function which mapscolumns of a relation to other columns. A query against recursive rules is then translated into a fixpoint functional equation. The resolution of this fixpoint equation using Tarski's theorem leads to efficient computation of the query answer. In particular, the derived algorithms push selections throu...