[Paper Review] Direct Access for Answers to Conjunctive Queries with Aggregation
This paper establishes a dichotomy for direct access to answers of conjunctive queries with aggregation, showing that efficient loglinear-time preprocessing and logarithmic-time random access is possible if and only if the query’s underlying structure is acyclic and free of disruptive trios—provided the aggregate value is not part of the lexicographic ordering. The results extend to standard aggregates (min, max, count, sum) via commutative semiring annotations and to count-distinct under a logarithmic-domain constraint, with a refined tractability condition when aggregates are included in the ordering.
We study the fine-grained complexity of conjunctive queries with grouping and aggregation. For some common aggregate functions (e.g., min, max, count, sum), such a query can be phrased as an ordinary conjunctive query over a database annotated with a suitable commutative semiring. Specifically, we investigate the ability to evaluate such queries by constructing in log-linear time a data structure that provides logarithmic-time direct access to the answers ordered by a given lexicographic order. This task is nontrivial since the number of answers might be larger than log-linear in the size of the input, and so, the data structure needs to provide a compact representation of the space of answers. In the absence of aggregation and annotation, past research provides a sufficient tractability condition on queries and orders. For queries without self-joins, this condition is not just sufficient, but also necessary (under conventional lower-bound assumptions in fine-grained complexity). We show that all past results continue to hold for annotated databases, assuming that the annotation itself is not part of the lexicographic order. On the other hand, we show infeasibility for the case of count-distinct that does not have any efficient representation as a commutative semiring. We then investigate the ability to include the aggregate and annotation outcome in the lexicographic order. Among the hardness results, standing out as tractable is the case of a semiring with an idempotent addition, such as those of min and max. Notably, this case captures also count-distinct over a logarithmic-size domain.
Motivation & Objective
- To determine the conditions under which conjunctive queries with aggregation can be evaluated via direct access with loglinear preprocessing and logarithmic access time.
- To extend prior tractability results for plain conjunctive queries to the case of aggregation, particularly for common aggregate functions like min, max, count, and sum.
- To analyze the impact of including aggregate values in the lexicographic ordering of answers, which introduces new complexity.
- To study the behavior of direct access when the database is annotated with a commutative semiring, especially when addition is idempotent (e.g., min, max, count-distinct).
- To establish a general framework for handling aggregation in direct access by reducing it to semiring-annotated queries and analyzing the resulting query structure.
Proposed method
- Represent aggregate queries as conjunctive queries over semiring-annotated databases, using commutative semirings to model aggregation (e.g., (N, min, +) for min, (N, max, +) for max, (N, +, ×) for sum, and (N, ∨, ∧) for count-distinct).
- Introduce the concept of Rcarry-deannotation to isolate the free-variable structure of a query after removing annotations, enabling analysis of the underlying query structure.
- Apply the known dichotomy for direct access on plain conjunctive queries (acyclic + no disruptive trio) to the deannotated query, under the assumption that the aggregate value is not part of the ordering.
- Establish a new tractability condition when the aggregate value is included in the lexicographic order, showing that such cases are significantly harder and require stricter structural constraints.
- Use the HYPERCLIQUE and SparseBMM hypotheses to prove intractability for non-acyclic or disruptive-trio-containing queries under the same assumptions.
- Generalize results to semirings with idempotent addition (e.g., min, max, count-distinct) by analyzing the structure of the Rcarry-deannotated query and applying a refined dichotomy.
Experimental results
Research questions
- RQ1Under what conditions can conjunctive queries with aggregation be evaluated via direct access with loglinear preprocessing and logarithmic access time?
- RQ2How does the inclusion of aggregate values in the lexicographic ordering affect the tractability of direct access?
- RQ3Can the tractability dichotomy for plain conjunctive queries be extended to queries with aggregation via semiring annotations?
- RQ4What is the impact of using a commutative semiring with idempotent addition (e.g., min, max, count-distinct) on the direct access complexity?
- RQ5How does the structure of the query—specifically acyclicity and the absence of disruptive trios—affect direct access when aggregation is involved?
Key findings
- For standard aggregates (min, max, count, sum), direct access is in ⟨loglinear, log⟩ if and only if the query’s free-variable projection is acyclic and has no disruptive trio, provided the aggregate value is not part of the ordering.
- The count-distinct aggregate can be handled under the same dichotomy, but only when the counted attribute has a logarithmic domain and is treated as a free variable at the end of the lexicographic order.
- When the aggregate value is included in the lexicographic order, the tractability condition becomes significantly more restrictive, and a new, narrower condition is required for efficiency.
- For semirings with idempotent addition (e.g., min, max, count-distinct), the dichotomy for direct access reduces to analyzing the Rcarry-deannotated query, and the same acyclicity and no-disruptive-trio condition applies.
- Intractability is proven under the HYPERCLIQUE and SparseBMM hypotheses for queries that are not acyclic or contain a disruptive trio, even when aggregation is present.
- The results generalize to self-join queries by first eliminating self-joins via relation symbol renaming and copying, preserving the structural properties relevant to tractability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.