Designing Neki for performance
Blog post from PlanetScale
Neki, a PostgreSQL sharding router, is designed to minimize overhead by retaining PostgreSQL protocol bytes and decoding data only when routing, sorting, grouping, or other operations require it. Unlike systems that eagerly convert every returned row and column into internal objects, Neki can forward raw query responses directly to clients, inspect only bind parameters needed to select a shard, and preserve text or binary value formats. For cross-shard queries, it progressively exposes more structure as needed: limits require identifying row boundaries, global sorting requires decoding only sort keys, and projections can remove or reorder columns by copying raw column frames rather than deserializing values. Fully decoding and reserializing values remains necessary for operations such as cross-shard aggregation, where the router must compare group keys and generate new results. This layered model allows rows to combine original wire messages with selectively cached decoded values, improving efficiency while preserving correctness for complex data types, encodings, NULLs, extension values, and byte-sensitive cases such as floating-point NaN payloads.
No tracked trend matches for this post yet.
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.