Datalog-based languages are regaining popularity as a powerful abstraction for expressing recursive computations in domains such as program analysis and graph processing. However, existing systems often face a trade-off between efficiency and extensibility. Engines like Souffle achieve high efficiency through domain-specific designs, but lack general-purpose flexibility. Others, like RecStep, offer modularity by layering Datalog on traditional databases, but struggle to integrate Datalog-specific optimizations. This paper bridges this gap by presenting FlowLog, a new Datalog engine that uses an explicit relational IR per-rule to cleanly separate recursive control (e.g., semi-naive execution) from each rule's logical plan. This boundary lets us retain fine-grained, Datalog-aware optimizations at the logical layer, but also reuse off-the-shelf database primitives at execution. At the logical level (i.e. IR), we apply proven SQL optimizations, such as logic fusion and subplan reuse. To address high volatility in recursive workloads, we adopt a robustness-first approach that pairs a structural optimizer (avoiding worst-case joins) with sideways information passing (early filtering). Built atop Differential Dataflow--a mature framework for streaming analytics--FlowLog supports both batch and incremental Datalog and adds novel recursion-aware optimizations called Boolean (or algebraic) specialization. Our evaluation shows that FlowLog outperforms state-of-the-art Datalog engines and modern databases across a broad range of recursive workloads, achieving superior scalability while preserving a simple and extensible architecture.
翻译:基于Datalog的语言作为一种强大的抽象,在程序分析和图处理等领域中表达递归计算时正重新获得关注。然而,现有系统往往在效率与可扩展性之间面临权衡。例如,Souffle等引擎通过领域特定设计实现了高效率,但缺乏通用灵活性;而RecStep等系统通过在传统数据库上分层Datalog来提供模块化,却难以整合Datalog特有的优化。本文通过提出FlowLog来弥合这一差距,这是一种新的Datalog引擎,它使用基于每规则的显式关系中间表示(IR),将递归控制(如半朴素执行)与每个规则的逻辑计划清晰分离。这一边界使我们能在逻辑层保留细粒度、Datalog感知的优化,同时在执行时复用现成的数据库原语。在逻辑层(即IR),我们应用了成熟的SQL优化技术,如逻辑融合和子计划重用。针对递归工作负载中的高波动性,我们采用以鲁棒性为先的方法,将结构优化器(避免最坏情况连接)与侧向信息传递(早期过滤)相结合。基于成熟的流分析框架Differential Dataflow构建,FlowLog支持批处理和增量Datalog,并引入了称为布尔(或代数)特化的新型递归感知优化。评估表明,FlowLog在广泛的递归工作负载中优于最先进的Datalog引擎和现代数据库,在保持简单且可扩展架构的同时实现了卓越的可扩展性。