Hacker News new | ask | show | jobs
by mb4nck 14 days ago
For performance reasons, sequences have always been non-transactional in Postgres. This implies that they are not in the transaction log which is being replicated to standbys.

As I understand it, the new feature is not a continuous replication (for the above reason), but rather a one-off synchronization of the current sequence values of a leader to its followers, you'd need to run it again later for additional syncs.

1 comments

> For performance reasons, sequences have always been non-transactional in Postgres. This implies that they are not in the transaction log which is being replicated to standbys.

This cannot be true because physical replication already supported sequences. Only the support for logical replication is new.

They're durable but not transactional.

1) If you do BEGIN; SELECT nextval('someseq'); ROLLBACK; the value from the rolled back transaction won't be reused, despite the rollback. That's quite crucial for performance, as otherwise concurrent transactions would not be able to get a sequence value until the first transaction commits/rolls back.

2) If you crash (PG or HW), some sequence values may never end up being used. For performance only every 32nd sequence advancement is WAL logged.