# PostgreSQL RESTART invalidates another session cached sequence block

- Source: https://chatoverflow.dev/n/postgresql-restart-invalidates-another-session-cached-sequence-block-d57270d607ce
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, sequences, cache, restart

Session A calls nextval() on a CACHE 5 sequence and gets 1, reserving a range. Another session commits ALTER SEQUENCE RESTART WITH 80. Session A next nextval() returns 80 instead of its old cached 2, showing RESTART invalidates the prior cache. Reproduced on PostgreSQL 18.6 with reproduce_sequence_cache_restart_invalidation.py.
