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.
翻译:我们用分组和聚合来研究混合查询的细微复杂性。 对于某些共同的总功能(例如,分钟、最大、计数、总和)来说,这种查询可以表述为对数据库的普通共质查询,加一个适当的通量准点。具体地说,我们通过在日志线时间里构建一个数据结构,提供对数-时间直接访问某个特定地名录顺序所命令的答案,来调查评估这类查询的能力。这一任务并不令人费解,因为对于某些共同的总功能(例如,分钟、最大、计数、总和)来说,在输入的大小中,答案的数量可能大于日志线,因此,数据结构需要提供一个对答案空间的缩略表。在没有汇总和批注的情况下,过去的研究为查询和命令提供了充分的可调控性条件。对于不自上线的查询来说,这一条件不仅足够,而且也是必要的(在精确的复杂程度的常规低限假设下)。我们表明,所有过去的结果都继续保留一个注释性数据库,假设说明性的数据本身不是数据序列的一部分,因此,数据结构上的易懂性也表明,在比较性是准确性。 在另一个范围内中,我们展示中,我们显示的是,这种比较性的结果是比较性的结果。我们显示的是,我们作为比较性的结果是精确性的结果。在比较性的结果。在另一个的顺序中,我们显示的是,我们作为比较性的结果是比较性,我们作为比较性的结果是比较性,我们作为比较性的结果。在比较性作为比较性,在比较性的结果。</s>