Monotonic Aggregation in Recursive Queries
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing query languages, such as SQL and Datalog, do not guarantee convergence to a fixed point when recursive queries contain non-monotonic aggregation functions, leading to the exclusion of recursive aggregates and requiring auxiliary queries for aggregation, which are space-inefficient.
Innovation Solution
The introduction of monotonic aggregation constructs, denoted as agg*, allows aggregation functions to be embedded directly in the recursive term of recursive definitions, ensuring that fixed points exist and aggregation is performed during query execution, reducing space requirements.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If non-monotonic aggregation functions are used in recursive queries, then aggregation capability is improved, but convergence to fixed point is not guaranteed
Solution Approach 1:
The patent transforms the aggregation function parameter from non-monotonic to monotonic. Specifically, it uses monotonic aggregation functions (such as MAX, MIN, COUNT) that satisfy the property: if input set A ⊆ input set B, then aggregation(A) ≤ aggregation(B). This parameter change ensures that the recursive query evaluation converges to a fixed point while maintaining aggregation capability.
2Measurement precision
If aggregation is performed after recursive query execution, then correctness is improved, but space efficiency deteriorates
Solution Approach 1:
The patent performs aggregation during the recursive query execution process itself, rather than as a separate post-processing step. The monotonic aggregation function is applied at each iteration of the recursive evaluation, allowing the system to compute aggregated values incrementally as the fixed point is approached, thereby avoiding the need to materialize the entire result table in memory.
3Adaptability or versatility
If auxiliary queries are used for aggregation, then aggregation flexibility is improved, but query complexity deteriorates
Solution Approach 1:
The patent merges the aggregation operation with the recursive query definition by allowing the monotonic aggregation function to be embedded directly in the recursive term. This combination eliminates the need for separate auxiliary queries while maintaining aggregation flexibility, as the aggregation is performed as an integral part of the recursive evaluation process.
Data Source
AI summary
Methods, systems, and apparatus, including computer programs encoded on computer storage media, for expressing and evaluating aggregation functions, including aggregation functions in the context of recursive aggregates, in data languages that implement fixed point semantics. One of the methods includes receiving input specifying, explicitly or implicitly, an aggregation function agg having an input type and an output type, a relation s that has a domain and a range and that represents one or more entities to be aggregated over, and a relation t that is a relation from the range of s to the input type of the aggregation function agg; and evaluating an aggregation construct agg* to calculate a relation between the domain of s and the output type of the aggregation function agg according to agg*(s,t)={(m,agg(n))|∃d:(m,d)εs,nεΠ{|t(y)|yεs(m)|}}.


