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引擎,采用基于规则的显式关系中间表示,将递归控制(如半朴素执行)与各规则的逻辑计划清晰分离。这种边界设计使得我们既能在逻辑层保留细粒度的Datalog感知优化,又能在执行层复用成熟的数据库原语。在逻辑层(即中间表示层),我们应用了经过验证的SQL优化技术,如逻辑融合和子计划复用。针对递归工作负载的高波动性,我们采用鲁棒性优先策略,将结构优化器(避免最坏情况连接)与侧向信息传递(早期过滤)相结合。基于流式分析成熟框架Differential Dataflow构建的FlowLog,同时支持批处理和增量Datalog计算,并新增了称为布尔(或代数)特化的递归感知优化技术。实验评估表明,FlowLog在各类递归工作负载中均优于最先进的Datalog引擎和现代数据库系统,在保持简洁可扩展架构的同时实现了卓越的可扩展性。