PlanetScale·
Sequences and other volatiles in Neki
TL;DR
Matching PostgreSQL sequence behavior across Neki’s shards requires preventing duplicate values and evaluating functions like nextval() the right number of times. Neki coordinates sequence allocation through its router and an authoritative shard, while its query planner keeps volatile expressions tied to the correct rows after joins and filters. This preserves unique sequence values and PostgreSQL behavior while allowing other query work to run on the shards.