proomt

Search

Search posts, papers, and topics

All posts

PlanetScaleDirkjan Bussink15 min readintermediate

Designing Neki for performance

Summary

Neki, a PostgreSQL proxy, achieves high performance by lazily decoding query results and bind parameters. It avoids unnecessary parsing and data conversions, keeping data in raw PostgreSQL wire format until specific operations like sorting or limiting require deeper inspection.

  • Neki's core performance principle is to avoid doing work, keeping data in raw PostgreSQL wire format as long as possible.
  • Query results are passed as raw byte slices in protobufs, only parsed into rows or columns when operations like LIMIT or ORDER BY demand it.
  • Bind parameters are also kept in their original frames, with only routing-critical parameters decoded and cached.
  • Neki preserves original text/binary data formats, only converting values if it needs to interpret them for internal logic.

Engineers building high-performance data proxies or database middleware will find this detailed approach to lazy data processing and protocol handling valuable.

7/10

Related reading

  1. The architecture of Neki

    Neki is PlanetScale’s sharding layer for vanilla PostgreSQL that presents a single Postgres endpoint while routing queries across a fleet of Postgres instances. It does this with a set of tightly‑coupled components—Router, Sidecar, PostgresManager, Admin, Operator, and etcd‑backed Data Topology—each handling a specific piece of the scaling, failover, and query‑planning puzzle.

    PlanetScaleplanetscale.com8 min
  2. Handling hot shards

    This article explains how PlanetScale's Neki, built on Vitess, helps manage hot shards in sharded databases, using Slack's journey from workspace-based to channel-based sharding as a detailed case study. It outlines strategies like vertical scaling, tenant isolation, and resharding specific tables without downtime to adapt to changing data access patterns.

    PlanetScaleplanetscale.com6 min
  3. Introducing Neon Labs

    Neon Labs is a new experimental web app (Next.js + TypeScript) that offers two PostgreSQL upgrade tools: a live‑catalog Upgrade Assessment that flags version‑specific blockers, and a Migration Assistant that auto‑generates import, pg_dump/restore, or logical‑replication pipelines based on DB size and downtime needs. The tools run read‑only against a Neon project, never expose connection strings,…

    Neonneon.com6 minrelease
  4. Neon is now available in Grok Bot

    Neon released a Grok Bot plugin that lets the AI assistant manage Neon PostgreSQL databases. After a one‑time auth, the bot can create projects, spin up isolated branches, run SQL, list databases, and set up usage‑summary routines directly from chat.

    Neonneon.com1 min
  5. A practical guide to cost optimization with Lakebase Postgres

    Lakebase’s separated storage‑compute architecture lets you cut database costs by syncing only the active data, picking the right sync mode, and right‑sizing compute so the hot working set fits in cache. Follow the blog’s concrete steps—materialized‑view subsets, snapshot vs triggered vs continuous sync, autoscale bounds, and connection‑pooling—to keep spend predictable without sacrificing perform…

    Databricksdatabricks.com12 min