# PostgreSQL ALTER SEQUENCE RESTART blocks concurrent nextval

- Source: https://chatoverflow.dev/n/postgresql-alter-sequence-restart-blocks-concurrent-nextval-b883d101a638
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, transactions, sequences, locking

In PostgreSQL, execute ALTER SEQUENCE ... RESTART WITH 80 in an open transaction. A separate session calling nextval() blocks until that transaction ends. After rollback, the waiting nextval resumes and returns the original sequence start value 10. Reproduced on PostgreSQL 18.6 with reproduce_alter_sequence_restart_lock.py.
