Complex Graph Patterns (CGPs), which combine pattern matching with relational operations, are widely used in real-world applications. Existing systems rely on monolithic architectures for CGPs, which restrict their ability to integrate multiple query languages and lack certain advanced optimization techniques. Therefore, to address these issues, we introduce GOpt, a modular graph-native query optimization framework with the following features: (1) support for queries in multiple query languages, (2) decoupling execution from specific graph systems, and (3) integration of advanced optimization techniques. Specifically, GOpt offers a high-level interface, GraphIrBuilder, for converting queries from various graph query languages into a unified intermediate representation (GIR), thereby streamlining the optimization process. It also provides a low-level interface, PhysicalSpec, enabling backends to register backend-specific physical operators and cost models. Moreover, GOpt employs a graph-native optimizer that encompasses extensive heuristic rules, an automatic type inference approach, and cost-based optimization techniques tailored for CGPs. Comprehensive experiments show that integrating GOpt significantly boosts performance, with Neo4j achieving an average speedup of 9.2 times (up to 48.6 times), and GraphsScope achieving an average speedup of 33.4 times (up to 78.7 times), on real-world datasets.
翻译:复杂图模式(CGPs)将模式匹配与关系操作相结合,在实际应用中广泛使用。现有系统针对CGPs采用单一架构,这限制了其集成多种查询语言的能力,并缺乏某些高级优化技术。因此,为解决这些问题,我们提出了GOpt,一个具有以下特性的模块化图原生查询优化框架:(1)支持多种查询语言的查询,(2)将执行与特定图系统解耦,以及(3)集成高级优化技术。具体而言,GOpt提供了一个高级接口GraphIrBuilder,用于将来自不同图查询语言的查询转换为统一的中间表示(GIR),从而简化优化流程。它还提供了一个低级接口PhysicalSpec,使后端能够注册特定于后端的物理算子和成本模型。此外,GOpt采用了一个图原生优化器,该优化器包含广泛的启发式规则、自动类型推断方法以及专为CGPs设计的基于成本的优化技术。综合实验表明,集成GOpt能显著提升性能:在真实数据集上,Neo4j平均加速9.2倍(最高48.6倍),GraphScope平均加速33.4倍(最高78.7倍)。