logo

Supporting Postgres Named Prepared Statements in Hyperdrive

ID: 8608b507-22ea-5e2e-85c8-282076d5d645

STIX ID: report--8608b507-22ea-5e2e-85c8-282076d5d645

Feed Name: Cloudflare Blog

Date Published: 2024-06-28

Date Updated: 2026-04-27

Author: Andrew Repp

...
...

Cloudflare’s Hyperdrive added support for PostgreSQL protocol-level named prepared statements across pooled connections, improving performance by enabling plan reuse without application changes. The post details how Hyperdrive buffers extended protocol messages (Parse, Bind, Execute, Sync, Describe), uses caching and transaction-mode pooling, and employs data structures (HashMap, LRU caches, VecDeque) to transparently manage statement preparation across different origin connections. It walks through four scenarios (parse/reuse × cache hit/miss) and outlines the trade-offs, such as occasional extra Parse injections and modest memory overhead, to maintain correctness and efficiency.

Your team is not currently subscribed to this feed. You must subscribe to it in order to see this post.