PlanetScale

Sequences and other volatiles in Neki

Oct 14, 2026Mats Rydberg
Sequences and other volatiles in Neki
SummaryAI, from the source post

This post details how Neki, PlanetScale's sharded Postgres, implements sequences to match native Postgres behavior. It focuses on handling volatile expressions and cross-shard synchronous evaluation. The router-only evaluation of `now()` is explained, contrasting it with `stable` expressions like `to_char()` which depend on GUCs. Sequences are classified as `volatile` and `router-only` due to the need for centralized governance to avoid duplicate values across shards. The post also defines `table expressions` as the basis for evaluating expressions per row and explains how Neki determines cardinality for correct evaluation of volatile expressions.

More from the Neki Query Performance trail