Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Strictly monotonic fields are quite expensive and the bigserial PK alone won't give you that.


PG bigserial is already strictly monotonic


No 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: