pgrust团队发布v0.4-beta版本,推出名为Gravity的新查询引擎。1 该引擎利用Claude编写的高效Rust代码作为“光速”参考目标,通过构建多阶段编译器管道实现了比ClickHouse快3倍且兼容完整Postgres SQL方言的性能。1
在架构设计上,Gravity采用四阶段编译管道:SQL -> Postgres Plan -> Pipeline Graph -> Lisp IR -> Assembly。1 针对列式存储格式,引入了三种特定规划算法:ZoneWalk(用于ORDER BY/LIMIT)、ZoneTopK(用于GROUP BY/LIMIT)和TwoPass(高基数分组的两遍扫描)。1
核心性能优化技术包括将238个核心函数直接内联至Lisp IR(使AVG查询快2.56倍)、字典编码的延迟物化(Late Materialization)以及在寄存器中折叠连续相同键值以哈希查找(Run Collapse in Registers)。1 基准测试显示,Gravity在ClickBench中比ClickHouse快3倍,同时支持完整的Postgres SQL方言和类型系统。1 相比pgrust原有的Volcano行执行器,Gravity冷启动快102倍,热运行快499倍。1 此外,开发团队使用Claude生成直接针对列式存储的高性能Rust程序,作为优化的参考上限。1 在c6a.4xlarge机器上,pgrust v0.4-beta总分高出PostgreSQL 17达1000倍以上,冷运行场景下高出1365倍。1
The pgrust team has released version v0.4-beta, introducing a new query engine named Gravity 1. The development team utilized high-performance Rust code generated by Claude to establish an optimized reference target, referred to as "light speed" 1. In ClickBench tests, Gravity performed three times faster than ClickHouse while maintaining full compatibility with the Postgres SQL dialect and type system 1.
Gravity employs a four-stage compilation pipeline that converts SQL into a Postgres Plan, then a Pipeline Graph, followed by Lisp IR, and finally Assembly 1. To optimize for columnar storage formats, the engine introduces specific planning algorithms: ZoneWalk for ORDER BY/LIMIT operations, ZoneTopK for GROUP BY/LIMIT, and TwoPass for two-pass scans in high-cardinality grouping scenarios 1. Key performance techniques include direct function inlining of 238 core functions into Lisp IR, which made AVG queries 2.56 times faster, along with dictionary-encoded late materialization and run collapse in registers to aggregate continuous identical keys for hash lookups 1.
Compared to pgrust’s original Volcano row executor, Gravity achieved a 102-fold improvement in cold start times and a 499-fold increase in hot run performance 1. When evaluated against PostgreSQL 17 on c6a.4xlarge machines, pgrust v0.4-beta scored more than 1,000 times higher overall, with cold run scenarios showing a 1,365-fold advantage 1.
评论
还没有评论,欢迎留下第一条。