In this paper we present a technique to optimize queries on deductive databases that use aggregate operations such as min, max, and “largest Ic values.” Our approach is based on an extended notion of relevance of facts to queries that takes aggregate operations into account. The approach has two parts: a rewriting part that labels predica.tes with “aggregate selections,” and an evaluat,ion part. t.hat, makes use of “aggregate selections” to detect that facts are irrelevant and discards them. The rewriting complements standard rewriting algorithms like Magic sets, and the evaluation essentially refines Semi-Naive evaluation.
S. Sudarshan, Raghu Ramakrishnan