Notion speeds up Postgres queries ~50% with extended query protocol pipelining
thesaraharminta · x · 2026-10-01
A Notion engineer shared a database optimization: implementing Postgres extended query protocol pipelining made queries about 50% faster.
- Notion runs many queries inside transactions to leverage pgbouncer transaction pooling plus SET LOCAL, so typical reads look like BEGIN; SET LOCAL searchpath... → SELECT → COMMIT, each a network round trip
- Pipelining via the extended query protocol cuts round trips from N to 1 for reads and N to 2 for writes
- Includes concrete code using ExtendedQueryPipeline to batch BEGIN/SET LOCAL/SELECT/COMMIT in one send, with a note that pipelining COMMIT may also be fine
More from Infra
- GLM 5.3 Flash kernels rewritten on RunInfra: 670 tok/s, 99.7% cache hit, AMD support — ycombinator · 2026-10-01
- Pareto partners with Engy to bring Bittensor SN10 inference optimization to external customers — markjeffrey · 2026-10-01
- Respan launches Span-01 router: 37% cheaper than best single model at matching accuracy — ycombinator · 2026-10-01
- RTX 3090 power can be dialed down to 120W for inference, saving power and heat — QuixiAI · 2026-10-01
- AI as compiler: model writes PTX directly, 1.37x speedup on FlashAttention over Triton — Azaliamirh · 2026-10-01
- Dell ships first Vera Rubin NVL72 rack-scale systems in volume, citing unprecedented NVIDIA partnership — yenkel · 2026-10-01