Papers
Topics
Authors
Recent
Search
2000 character limit reached

Free-Connex Acyclic Conjunctive Queries

Updated 15 January 2026
  • Free-connex ACQs are self-join-free acyclic conjunctive queries that remain acyclic when a hyperedge is added over the free variables, ensuring tractable evaluation.
  • They leverage join tree decompositions and dynamic programming to achieve O(|I|) preprocessing and O(1) delay per answer, marking a breakthrough in query evaluation.
  • Applications span efficient algorithms in linear algebra (MATLANG), indexing strategies, and query optimization in databases, providing actionable insights for real-world scenarios.

A free-connex acyclic conjunctive query (fc-ACQ) is a pivotal structural notion in the theory of conjunctive query (CQ) evaluation, capturing precisely the class of self-join-free acyclic CQs for which constant-delay enumeration and linear-time preprocessing are achievable. This property is characterized by the requirement that the query’s hypergraph remains acyclic when augmented with a hyperedge over the head (free) variables. The following comprehensive article presents the key definitions, complexity dichotomies, enumeration algorithms, generalizations, width measures, and applications to related domains.

1. Structural Definition and Characterization

Let Q(xˉ)R1(vˉ1),...,Rm(vˉm)Q(\bar{x}) \leftarrow R_1(\bar{v}_1), ..., R_m(\bar{v}_m) be a self-join-free CQ over a relational schema. Associate to QQ a hypergraph H(Q)=(V,E)H(Q) = (V,E), where VV is the set of all variables appearing in the query, and EE is the set of variable sets in each atom, i.e., E={vars(vˉi)i=1,...,m}E = \{\operatorname{vars}(\bar{v}_i)\mid i=1,...,m\}.

A hypergraph is acyclic if it admits a join tree, i.e., a tree whose nodes are the hyperedges, such that for every variable xVx \in V, the set of edges containing xx induces a connected subtree.

QQ is free-connex acyclic (fc-ACQ, sometimes also "free-connex") if:

  • H(Q)H(Q) is acyclic
  • Adding a new hyperedge X=free(Q)X = \operatorname{free}(Q) (the set of head variables) to form H+(Q)=(V,E{X})H^+(Q) = (V, E \cup \{X\}) preserves acyclicity

Equivalently, QQ fails to be free-connex exactly when there exists a chordless path (a head-path) in H(Q)H(Q) connecting two distinct free variables with all internal nodes non-free (i.e., a "head-path" of length at least 2) (Carmeli et al., 2017, Carmeli et al., 2018).

2. Enumeration Complexity Dichotomies and Lower Bounds

Enumeration Dichotomy (Bagan–Durand–Grandjean 2007, Brault-Baron 2013):

Let QQ be a self-join-free acyclic CQ. Then:

  • If QQ is free-connex, one can enumerate all answers Q(I)Q(I) with O(I)O(|I|) preprocessing and O(1)O(1) delay per answer (i.e., EnuQ\text{Enu}_Q \in DelayClin).
  • If QQ is acyclic but non-free-connex, under the Boolean matrix multiplication conjecture, constant-delay enumeration after linear preprocessing is impossible (Carmeli et al., 2017, Carmeli et al., 2019, Carmeli et al., 2018, Mengel, 2021).

A clear frontier emerges: fc-ACQs are the unique maximal class of self-join-free acyclic CQs admitting enumeration in linear preprocessing and constant delay.

Counting Dichotomy:

  • For fc-ACQs, counting the answers can also be done in O(D)O(|D|) time.
  • If the query’s "quantified star size" (see §5) is k2k \geq 2, Ω(Dk)\Omega(|D|^k) time is needed under fine-grained complexity conjectures (Mengel, 2021).

3. Algorithms for Enumeration and Counting

The classical evaluation of fc-ACQs is based on Yannakakis’s algorithm and join trees (Carmeli et al., 2018, Carmeli et al., 2017, Carmeli et al., 2019):

Preprocessing (O(|D|) Time)

  • Compute a join tree TT of H+(Q)H^+(Q).
  • For each atom and for each pair of neighboring hyperedges in TT, build indexes keyed by shared variables. This uses sorting or hashing and is done in linear time.

Enumeration (Constant Delay)

  • Perform a depth-first traversal of TT.
  • For each tree node:
    • Maintain an iterator over the tuples of its relation consistent with the assignments fixed in the parent.
    • At the root, pick the first tuple.
    • For each child, use the index to jump to matching tuples, recurse.
    • When all children are fixed, output the projection to the free variables.
    • Advance the lowest-level node’s iterator with a next tuple, reset all children’s iterators, and repeat.

The height of TT is bounded by QQ, so each step costs O(1)O(1), ensuring constant delay.

Counting Algorithm: Use dynamic programming along the join tree, bottom-up, so that each bag computes the number of partial answer extensions. For fc-ACQs the recurrence is O(1) per bag; total O(D)O(|D|) (Riveros et al., 2024, Riveros et al., 8 Jan 2026).

4. Width Measures and Generalizations

Free-Connex Fractional Hypertree Width (fc-fhtw)

Let (T,χ) be a join-tree, χ(t)vars(Q)χ(t) \subseteq \operatorname{vars}(Q). The fc-fhtw(Q) is the minimal (over free-connex decompositions) maximum fractional edge-cover number among the bags in the decomposition (Khamis et al., 11 Dec 2025). For acyclic fc-ACQs, fc-fhtw(Q)=1(Q)=1. Output-sensitive complexity of (C)RPQs is governed by this parameter:

  • Runtime O(N+NOUT11/max(w,2)+OUT)O(N+N \cdot OUT^{1-1/\max(w,2)} + OUT), where w=fc-fhtw(Q)w = \text{fc-fhtw}(Q), NN is input size, and OUTOUT is output size.

Submodular Width

More generally, constant-delay enumeration is possible for bounded free-connex submodular width (fc-SUBW), which collapses to 1 precisely for fc-ACQs (Berkholz et al., 2020).

Quantified Star Size

For acyclic CQs, the quantified star size equals 1 if and only if the query is free-connex. Quantified star size kk implies worst-case lower bound Ω(mk)\Omega(m^k) for counting, where mm is input size (Mengel, 2021).

5. Extensions to Broader Query Classes and Indexing

Unions of CQs (UCQs)

Enumeration with linear preprocessing/constant delay for UCQs is more subtle. A UCQ is free-connex if each disjunct can be made free-connex by "borrowing" (i.e., using union extensions) from other disjuncts. All such UCQs admit DelayClin enumeration (Carmeli et al., 2018).

Functional Dependencies, Cardinality and DL Roles

For queries with functional dependencies (FDs) or similar dependencies (e.g., unary FDs, key constraints, DL functional roles), one first computes the FD-extension of QQ by “chasing” the dependencies, adjusts the head as needed, and checks free-connex acyclicity of the extended query. If this holds, DelayClin enumeration is retained (Carmeli et al., 2017, Lutz et al., 2022, Carmeli et al., 2018).

Conjunctive Queries with Negation and Aggregation

The notion of free-connex signed-acyclicity strictly generalizes fc-ACQ to the case of queries with negation. For self-join-free queries with negation or aggregates (FAQ^-), enumeration and aggregation remain tractable—linear preprocessing and constant delay—if and only if the underlying signed hypergraph is free-connex signed-acyclic (Zhao et al., 2023).

Index Structures: Structural and Color-based Indexing

Recent work establishes efficient database-side index structures for fc-ACQs:

  • Structural indexing via color refinement: Build an auxiliary database DcolD_{col} encoding the coarsest stable coloring of the input domain under Weisfeiler--Leman color refinement. For any fc-ACQ QQ, the answer can be enumerated or counted in time O(QDcol)O(|Q| \cdot |D_{col}|), which may be sublinear in D|D| for regular or highly symmetric data (Riveros et al., 8 Jan 2026, Riveros et al., 2024).
Input Structure Index Size Preprocessing Per-Query Cost Reference
General database D|D| O(D)O(|D|) O(D)O(|D|) (Carmeli et al., 2018)
Structural indexing D\le|D| O(DlogD)O(|D|\log|D|) O(QDcol)O(|Q|\,|D_{col}|) (Riveros et al., 8 Jan 2026)
Regular graphs O(1)O(1) O(1)O(1) O(Q)O(|Q|) (Riveros et al., 8 Jan 2026)

6. Applications in Database and Linear Algebra Query Evaluation

Linear Algebra (MATLANG)

fc-ACQs exactly characterize the fragment of first-order logic expressible as tree-shaped join patterns, corresponding to a fragment of MATLANG (Sum-MATLANG) expressions ("FC-MATLANG") that admit constant-delay enumeration after linear preprocessing on sparse semiring-annotated matrices (Muñoz et al., 2023).

Query Rewriting, View Selection, and Optimization

Deciding whether an acyclic CQ admits an acyclic or free-connex acyclic rewriting is NP-hard in general. However, if all views are fc-ACQ, rewritability checking becomes tractable for bounded arity schemas. This has immediate implications for view selection and query optimization in data integration (Geck et al., 2022).

7. Illustrative Examples

Query Type Definition Query Graph/Hypergraph Free-Connex? Complexity
Q1(x,y)R(x,z),S(z,y)Q_1(x,y) \gets R(x,z), S(z,y) Two binary atoms, head (x,y)(x,y) Path, plus (x,y)(x,y) edge Yes DelayClin, O(1) delay
Q2(x,y)R1(x,z1),R2(z1,z2),R3(z2,y)Q_2(x,y) \gets R_1(x,z_1), R_2(z_1,z_2), R_3(z_2,y) Chain, head (x,y)(x,y) Path, plus (x,y)(x,y) edge creates a cycle No Hard unless BMM breaks
  • For regular graphs (e.g., cycles): the color-refinement based DcolD_{col} reduces to a single color; query evaluation on Q|Q| plus constant delay (Riveros et al., 8 Jan 2026, Riveros et al., 2024).
  • In contrast, for random graphs with no symmetry, Dcol=Θ(D)|D_{col}| = \Theta(|D|) and the method reduces to classical costs.

References

  • (Carmeli et al., 2017) Enumeration Complexity of Conjunctive Queries with Functional Dependencies
  • (Carmeli et al., 2018) On the Enumeration Complexity of Unions of Conjunctive Queries
  • (Carmeli et al., 2019) Answering (Unions of) Conjunctive Queries using Random Access and Random-Order Enumeration
  • (Mengel, 2021) A short note on the counting complexity of conjunctive queries
  • (Muñoz et al., 2023) Enumeration and updates for conjunctive linear algebra queries through expressibility
  • (Geck et al., 2022) Rewriting with Acyclic Queries: Mind Your Head
  • (Zhao et al., 2023) Conjunctive Queries with Negation and Aggregation: A Linear Time Characterization
  • (Berkholz et al., 2020) Constant delay enumeration with FPT-preprocessing for conjunctive queries of bounded submodular width
  • (Lutz et al., 2022) Efficient Answer Enumeration in Description Logics with Functional Roles -- Extended Version
  • (Khamis et al., 11 Dec 2025) Acyclic Conjunctive Regular Path Queries are no Harder than Corresponding Conjunctive Queries
  • (Riveros et al., 8 Jan 2026) Structural Indexing of Relational Databases for the Evaluation of Free-Connex Acyclic Conjunctive Queries
  • (Riveros et al., 2024) Using Color Refinement to Boost Enumeration and Counting for Acyclic CQs of Binary Schemas

In summary, free-connex acyclic conjunctive queries are deeply connected to tractability frontiers in fine-grained enumeration and counting complexity, admit robust characterizations via tree decompositions, and underpin optimal algorithms and indexing strategies for conjunctive query processing across logic, databases, and linear algebra systems.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Free-Connex Acyclic Conjunctive Queries (fc-ACQs).