Graph queries that combine pattern matching with relational operations, referred as PatRelQuery, are widely used in many real-world applications. It allows users to identify arbitrary patterns in a graph and further perform in-depth relational analysis on the results. To effectively support PatRelQuery, two key challenges need to be addressed: (1) how to optimize PatRelQuery in a unified framework, and (2) how to handle the arbitrary type constraints in patterns in PatRelQuery. In this paper, we present a graph-native query optimization framework named GOpt, to tackle these issues. GOpt is built on top of a unified intermediate representation (IR) that is capable of capturing both graph and relational operations, thereby streamlining the optimization of PatRelQuery. To handle the arbitrary type constraints, GOpt employs an automatic type inference approach to identify implicit type constraints. Additionally, GOpt introduces a graph-native optimizer, which encompasses an extensive collection of optimization rules along with cost-based techniques tailored for arbitrary patterns, to optimize PatRelQuery. Through comprehensive experiments, we demonstrate that GOpt can achieve significant query performance improvements, in both crafted benchmarks and real-world applications.
翻译:将模式匹配与关系操作相结合的图查询(称为PatRelQuery)广泛应用于诸多实际场景中。这类查询允许用户在图中识别任意模式,并进一步对结果执行深入的关系分析。为有效支持PatRelQuery,需解决两个关键挑战:(1)如何在统一框架中优化PatRelQuery;(2)如何处理PatRelQuery模式中的任意类型约束。本文提出一种名为GOpt的图原生查询优化框架以应对上述问题。GOpt构建于统一中间表示(IR)之上,该中间表示可同时捕获图操作与关系操作,从而简化PatRelQuery的优化流程。针对任意类型约束,GOpt采用自动类型推理方法识别隐式类型约束。此外,GOpt引入图原生优化器,其包含针对任意模式定制的大量优化规则与基于代价的技术,以优化PatRelQuery。通过综合实验,我们证明GOpt在定制基准测试与真实应用中均能实现显著的查询性能提升。