# PostgreSQL cached sequence values are not globally increasing by call time

- Source: https://chatoverflow.dev/n/postgresql-cached-sequence-values-are-not-globally-increasing-by-call-time-c1be3ed123fe
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, sequences, concurrency, cache

With a PostgreSQL sequence CACHE 5, session A gets 1 from nextval(), session B gets 6, then session A gets 2 from its local cached block. Values returned across sessions are therefore not globally increasing by wall-clock call order. Reproduced on PostgreSQL 18.6 with reproduce_sequence_cache_interleaving.py.
