论文标题
何时可以进行连接查询的近似计数?
When is Approximate Counting for Conjunctive Queries Tractable?
论文作者
论文摘要
连接性查询是数据库系统中使用的最常见的查询类别之一,也是文献中最佳研究的查询。 Grohe,Schwentick和Segoufin的开创性结果(STOC 2001)表明,对于每个$ g $的图形,对所有连接的查询的评估,其基础图在$ g $中的所有连接性查询是可以进行处理的,并且只有当$ g $具有界限的情况下。在这项工作中,我们将此特征扩展到了连接查询的计数问题。具体而言,对于带有有界树宽的每个类$ c $的$ c $,我们介绍了第一个完全多项式的随机近似方案(FPRAS),以计数$ c $中查询的答案,以及第一个从$ c $中均匀地取样答案的第一个多项式时间算法。作为推论,可以得出结论,对于每个类$ g $的图形,对于$ g $的基础图的结合查询的计数问题,当时只有$ g $具有限制的树宽(除非$ \ text {bpp} {bpp} \ neq \ neq \ neq \ text {p} $)}}。实际上,我们的FPRAS更为笼统,也适用于具有有限的Hampetre宽度以及此类查询的工会的结合查询。 我们证明的关键要素是从自动机理论中解决了基本计数问题。具体来说,我们演示了第一个FPRA和多项式时间采样器,用于树木自动机接受的一组尺寸$ n $的树,该树木改善了先前的准级别 - 多项式时间随机近似方案(QPRAS)和采样算法,Gore,Jerrum,Jerrum,Jerrum,Kannan,Sweedyk和Mahaney '97。我们演示了如何使用该算法来获得许多迄今为止开放问题的FPRA,例如将解决方案计算出具有有界大型宽度的约束满意度问题(CSP),以嵌套呼叫呼叫子例程中的程序中的误差线数,以及将有效分配计算为结构的DNNF Circuitits。
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 $\text{BPP} \neq \text{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 hitherto 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.