6 ms·
Strictly monotonic fields are quite expensive and the bigserial PK alone won't give you that.
by x3al 2y ago
Strictly monotonic fields are quite expensive and the bigserial PK alone won't give you that.
- kroolik 2y agoPG bigserial is already strictly monotonic
- blackenedgem 2y agoNo they're not, even with a `cache` value of 1. Sequence values are issued at insert rather than commit. A transaction that commits later (which makes all updates visible) can have an earlier value than a previous transaction. This is problematic if you try to depend on the ordering. Nothing is stopping some batch process that started an hour ago from committing a value 100k lower than where you thought the sequence was at. That's an extreme example but the consideration is the same when dealing with millisecond timeframes.
- deleted 2y ago[deleted]