PostgreSQL学徒

How to implement high performance pluggable vectorized executor in PostgreSQL

PostgreSQL 在很多场景下,性能瓶颈不只是存储层、索引层、规划器层,Executor 本身的 CPU 执行效率也非常关键。在 PGConf India 2025,Amit Langote 做过一次《Hacking Postgres Executor For Performance》的分享,作者从现代 CPU 的执行特点出发,解释了为什么 PostgreSQL 传统的 Volcano/Iterator 模型会带来较多函数调用、分支判断、cache miss、branch misprediction,进而增加每 tuple 的处理成本。随后他列举了 PostgreSQL 社区这些年已经合入的一系列 executor 优化,并展望了更大规模的 executor 重写方向:opcode 化、batch/vectorized 执行、JIT/compiled plan。

Postgres Conference 2026 (https://postgresconf.org/conferences/postgresconf_2026) 将于 4.21 ~ 23 于美国圣何塞举办,到时笔者将分享 《YMatrix mxvector: How to implement high performance pluggable vectorized executor in PostgreSQL》

Image

既然传统 executor 有这些先天限制,那么我们如何在 PostgreSQL 现有扩展机制之上,做一个高性能、可插拔的 vectorized executor,这个能力可以通过 PostgreSQL 现有扩展机制实现,包括 slots、custom scans、planner hooks、table AMs,而且不需要修改 PostgreSQL core kernel code ~ 欢迎各位前来交流