When Is Approximate Counting for Conjunctive Queries Tractable?
Abstract
Conjunctive 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 evaluation of all conjunctive queries whose underlying graph is in g is tractable if, and only if, g has bounded treewidth. In this work, we extend this characterization to the counting problem for conjunctive queries. Specifically, for every class C of conjunctive queries with bounded treewidth, we introduce the first fully polynomial-time randomized approximation scheme (FPRAS) for counting answers to a query in C, and the first polynomial-time algorithm for sampling answers uniformly from a query in C. As a corollary, it follows that for every class g of graphs, the counting problem for conjunctive queries whose underlying graph is in g admits an FPRAS if, and only if, g has bounded treewidth (unless BPP not equal P). In fact, our FPRAS is more general, and also applies to conjunctive queries with bounded hypertree width, as well as unions of such queries. The key ingredient in our proof is the resolution of a fundamental counting problem from automata theory. Specifically, we demonstrate the first FPRAS and polynomial time sampler for the set of trees of size n accepted by a tree automaton, which improves the prior quasi-polynomial time randomized approximation scheme (QPRAS) and sampling algorithm of Gore, Jerrum, Kannan, Sweedyk, and Mahaney '97. We demonstrate how this algorithm can be used to obtain an FPRAS for many open problems, such as counting solutions to constraint satisfaction problems (CSP) with bounded hypertree width, counting the number of error threads in programs with nested call subroutines, and counting valid assignments to structured DNNF circuits.
Más información
Título según WOS: | When Is Approximate Counting for Conjunctive Queries Tractable? |
Título de la Revista: | STOC '21: PROCEEDINGS OF THE 53RD ANNUAL ACM SIGACT SYMPOSIUM ON THEORY OF COMPUTING |
Editorial: | ASSOC COMPUTING MACHINERY |
Fecha de publicación: | 2021 |
Página de inicio: | 1015 |
Página final: | 1027 |
DOI: |
10.1145/3406325.3451014 |
Notas: | ISI |