We investigate trade-offs in static and dynamic evaluation of hierarchical queries with arbitrary free variables. In the static setting, the trade-off is between the time to partially compute the query result and the delay needed to enumerate its tuples. In the dynamic setting, we additionally consider the time needed to update the query result under single-tuple inserts or deletes to the database. Our approach observes the degree of values in the database and uses different computation and maintenance strategies for high-degree (heavy) and low-degree (light) values. For the latter it partially computes the result, while for the former it computes enough information to allow for on-the-fly enumeration. We define the preprocessing time, the update time, and the enumeration delay as functions of the light/heavy threshold. By appropriately choosing this threshold, our approach recovers a number of prior results when restricted to hierarchical queries. We show that for a restricted class of hierarchical queries, our approach achieves worst-case optimal update time and enumeration delay conditioned on the Online Matrix-Vector Multiplication Conjecture.
翻译:我们研究了具有任意自由变量的层级查询在静态与动态评估中的权衡。在静态场景中,权衡体现在部分计算查询结果的时间与枚举其元组所需的延迟之间。在动态场景中,我们额外考虑了在数据库中进行单条元组插入或删除时更新查询结果所需的时间。我们的方法观测数据库中值的度数,并对高度数(重度)值与低度数(轻度)值采用不同的计算与维护策略:对于轻度值,我们部分计算结果;对于重度值,则计算足够的信息以支持即时枚举。我们将预处理时间、更新时间和枚举延迟定义为轻/重度阈值的函数。通过适当选择该阈值,我们的方法在限制为层级查询时能够复现多项先前研究结果。我们证明,对于一类受限的层级查询,基于在线矩阵-向量乘法猜想,我们的方法实现了最坏情况下的最优更新时间与枚举延迟。