ABSTRACT
Counting the number of answers to conjunctive queries is an intractable problem, formally #P-hard, even over classes of acyclic queries. However, Durand and Mengel have recently introduced the notion of quantified star size that, combined with hypertree decompositions, identifies islands of tractability for the problem. They also wonder whether such a notion precisely characterizes those classes for which the counting problem is tractable. We show that this is the case only for bounded-arity simple queries, where relation symbols cannot be shared by different query atoms. Indeed, we give a negative answer to the question in the general case, by exhibiting a more powerful structural method based on the novel concept of #-generalized hypertree decomposition. On classes of queries with bounded #-generalized hypertree width, counting answers is shown to be feasible in polynomial time, after a fixed-parameter polynomial-time preprocessing that only depends on the query structure. A weaker variant (but still more general than the technique based on the quantified starsize) is also proposed, for which tractability is established without any exponential dependency on the query size. Based on #-generalized hypertree decompositions, a hybrid decomposition method is eventually conceived, where structural properties of the query are exploited in combination with properties of the given database, such as keys or other (weaker) dependencies among attributes that limit the allowed combinations of values. Intuitively, such features may induce different structural properties that are not identified by the worst-possible database perspective of purely structural methods.
- S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Addison-Wesley, 1995. Google ScholarDigital Library
- . Adler, G. Gottlob, and M. Grohe. Hypertree-Width and Related Hypergraph Invariants. European Journal of Combinatorics, 28, pp. 2167--2181, 2007. Google ScholarDigital Library
- . Atserias, M. Grohe, and D. Marx. Size bounds and query plans for relational joins. SIAM Journal on Computing, 42(4):1737--1767, 2013.Google ScholarDigital Library
- . Bagan, A. Durand, and E. Grandjean. On acyclic conjunctive queries and constant delay enumeration. In phProc. of CSL'07, pp. 208--222, 2007. Google ScholarDigital Library
- . Bulatov, V. Dalmau, M. Grohe, and D. Marx. Enumerating Homomorphisms. phJournal of Computer and System Sciences, 78(2): 638--650, 2012. Google ScholarDigital Library
- .A. Bernstein and N. Goodman. The power of natural semijoins. SIAM Journal on Computing, 10(4), pp. 751--771, 1981.Google ScholarDigital Library
- .A. Bulatov. The complexity of the counting constraint satisfaction problem. Journal of the ACM, 60(5), Article 34, 2013. Google ScholarDigital Library
- .A. Bulatov, M. Dyer, L.A. Goldberg, M. Jerrum, and C. Mcquillan. The expressibility of functions on the boolean domain, with applications to counting CSPs. Journal of the ACM, 60(5), Article 32, 2013. Google ScholarDigital Library
- . Chekuri and A. Rajaraman. Conjunctive query containment revisited. Theoretical Computer Science, 239(2), pp. 211--229, 2000. Google ScholarDigital Library
- .A. Cohen, M.C. Cooper, P. Creed, D. Marx, and A.Z. Salamon. The tractability of CSP classes defined by forbidden patterns. phJournal of Artificial Intelligence Research, 45:47--78, 2012. Google ScholarDigital Library
- .C. Cooper, P.G. Jeavons, and A.Z. Salamon. Generalizing constraint satisfaction on trees: Hybrid tractability and variable elimination. phArtificial Intelligence, 174(9--10):570--584, 2010. Google ScholarDigital Library
- . Dalmau and P. Jonsson. The complexity of counting homomorphisms seen from the other side. phTheor. Computer Science, 329(1--3), pp. 315--323, 2004. Google ScholarDigital Library
- . Downey and M. Fellows. Parameterized Complexity. Springer, 1999. Google ScholarDigital Library
- A.Durand and S. Mengel. Structural Tractability of Counting of Solutions to Conjunctive Queries. In Proc. of ICDT'13, pp. 81--92, 2013. Google ScholarDigital Library
- . Fagin. Degrees of acyclicity for hypergraphs and relational database schemes. Journal of the ACM, 30(3):514--550, 1983. Google ScholarDigital Library
- . Flum, M. Frick, and M. Grohe. Query evaluation via tree-decompositions. Journal of the ACM, 49(6):716--752, 2002. Google ScholarDigital Library
- . Flum and M. Grohe. The parameterized complexity of counting problems, phSIAM Journal on Computing, 33:892--922, 2004. Google ScholarDigital Library
- .P. Gomes, W.J. Van Hoeve, A. Sabharwal, and B. Selman. Counting CSP solutions using generalized XOR constraints. In Proc. of AAAI'07, pp. 204--209. %, 2007. Google ScholarDigital Library
- . Gottlob, N. Leone, and F. Scarcello. Hypertree decompositions and tractable queries. Journal of Computer and System Sciences, 64(3):579--627, 2002.Google ScholarDigital Library
- . Gottlob, S. Tien Lee, G. Valiant, and P. Valiant. Size and Treewidth Bounds for Conjunctive Queries. phJournal of the ACM, 59(3), 2012. Google ScholarDigital Library
- . Gottlob, N. Leone, and F. Scarcello. Robbers, marshals, and guards: game theoretic and logical characterizations of hypertree width. Journal of Computer and System Sciences, 66(4):775--808, 2003. Google ScholarDigital Library
- . Gottlob, Z. Miklós, and T. Schwentick. Generalized hypertree decompositions: NP-hardness and tractable variants. Journal of the ACM, 56(6), Article 16, 2009. Google ScholarDigital Library
- . Goodman and O. Shmueli. The tree projection theorem and relational query processing. Journal of Computer and System Sciences, 29(3):767--786, 1984.Google Scholar
- . Ghionna, L.Granata, G. Greco, and F. Scarcello.Hypertree Decompositions for Query Optimization.In Proc. of ICDE '07, pp. 36--45, 2007.Google Scholar
- . Greco and F. Scarcello. Structural tractability of enumerating CSP solutions. Constraints, 18(1):8--74, 2013. Google ScholarDigital Library
- . Greco and F. Scarcello. The power of tree projections: local consistency, greedy algorithms, and larger islands of tractability. In Proc. of PODS'10, pp. 327--338, 2010. Full version available as CoRR technical report ph1205.3321. Google ScholarDigital Library
- . Greco and F. Scarcello. Tree Projections: Hypergraph Games and Minimality. In Proc. of ICALP'08, pp. 736--747, 2008. Google ScholarDigital Library
- . Grohe. The complexity of homomorphism and constraint satisfaction problems seen from the other side. Journal of the ACM, 54(1), Article 1, 2007. Google ScholarDigital Library
- . Grohe and D. Marx. Constraint solving via fractional edge covers. In Proc. of SODA'06, pp. 289--298, 2006. Google ScholarDigital Library
- . Koch. Processing queries on tree-structured data efficiently. In phProc. of PODS'06, pp. 213--224, 2006. Google ScholarDigital Library
- . Kimelfeld and Y. Sagiv. Incrementally computing ordered answers of acyclic conjunctive formulas. In Proc. of NGITS'06, pp. 33--38, 2006. Google ScholarDigital Library
- . Marx. Approximating fractional hypertree width. ACM Tran. on Algorithms, 6(2), Article 29, 2010. Google ScholarDigital Library
- . Marx. Tractable Hypergraph Properties for Constraint Satisfaction and Conjunctive Queries. In phProc. of STOC'10, pp. 735--744, 2010. Google ScholarDigital Library
- . Pesant. Counting solutions of CSPs: a structural approach. In Proc. of IJCAI'05, pp. 260--265, 2005. Google ScholarDigital Library
- . Pichler and A. Skritek. Tractable Counting of the Answers to Conjunctive Queries. phJournal of Computer and System Sciences, 79(6):984--1001, 2013. Google ScholarDigital Library
- . Robertson and P.D. Seymour. Graph minors III: Planar tree-width. Journal of Combinatorial Theory, Series B, 36:49--64, 1984.Google ScholarCross Ref
- . Robertson and P.D. Seymour. Graph minors V: Excluding a planar graph. Journal of Combinatorial Theory, Series B, 41:92--114, 1986. Google ScholarDigital Library
- . Saccà, E. Serra, and A. Guzzo. Count Constraints and the Inverse OLAP Problem: Definition, Complexity and a Step toward Aggregate Data Exchange.In Proc. of FOIKS'12, pp. 352--369, 2012. Google ScholarDigital Library
- . Scarcello, G. Greco, and N. Leone. Weighted Hypertree Decompositions and Optimal Query Plans. In Proc. of PODS'04, pp. 210--221, 2004. Google ScholarDigital Library
- . D. Ullman. Principles of Database and Knowledge Base Systems. Computer Science Press, 1989. Google ScholarDigital Library
- M. Yannakakis. Algorithms for acyclic database schemes. In Proc. of VLDB'81, pp. 82--94, 1981. Google ScholarDigital Library
Index Terms
- Counting solutions to conjunctive queries: structural and hybrid tractability
Recommendations
When is approximate counting for conjunctive queries tractable?
STOC 2021: Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of ComputingConjunctive queries are one of the most common class of queries used in database systems, and the best studied in the literature. A seminal result of Grohe, Schwentick, and Segoufin (STOC 2001) demonstrates that for every class G of graphs, the ...
Counting Answers to Unions of Conjunctive Queries: Natural Tractability Criteria and Meta-Complexity
PACMMOD (PODS)We study the problem of counting answers to unions of conjunctive queries (UCQs) under structural restrictions on the input query. Concretely, given a class C of UCQs, the problem #UCQ (C) provides as input a UCQ Ψ ∈ C and a database D and the problem is ...
Structural tractability of counting of solutions to conjunctive queries
ICDT '13: Proceedings of the 16th International Conference on Database TheoryIn this paper we explore the problem of counting solutions to conjunctive queries. We consider a parameter called the quantified star size of a formula φ which measures how the free variables are spread in φ. We show that for conjunctive queries that ...
Comments