Static filtering is a data-independent optimisation method for Datalog, which generalises algebraic query rewriting techniques from relational databases. In spite of its early discovery by Kifer and Lozinskii in 1986, the method has been overlooked in recent research and system development, and special cases are being rediscovered independently. We therefore recall the original approach, using updated terminology and more general filter predicates that capture features of modern systems, and we show how to extend its applicability to answer set programming (ASP). The outcome is strictly more general but also more complex than the classical approach: double exponential in general and single exponential even for predicates of bounded arity. As a solution, we propose tractable approximations of the algorithm that can still yield much improved logic programs in typical cases, e.g., it can improve the performance of rule systems over real-world data in the order of magnitude.
翻译:静态过滤是Datalog中一种独立于数据的优化方法,它推广了关系数据库中代数查询重写技术。尽管该方法早在1986年就由Kifer和Lozinskii发现,但在近年研究与系统开发中却长期被忽视,其特例反而被不断独立重复发现。为此,我们以更新的术语和能捕捉现代系统特征的更通用过滤谓词,重新阐释这一原始方法,并展示如何将其适用性扩展至答案集编程(ASP)。相较于经典方法,新方案在严格更通用的同时复杂度也更高:通常呈双指数级,即使对有限元数谓词也需单指数时间。作为解决方案,我们提出该算法的可处理近似版本,在典型场景中仍能显著改进逻辑程序性能——例如可将现实数据规则系统的执行效率提升一个数量级。