Hello all,
I have a question about the monotonicity of the unique_rowid() function. The documentation on SERIAL and unique_rowid implies that it only increases (with gaps). However, it seems that the implementation uses the node id for bits 0-14 and a timestamp for bits 15-62, leaving the final top bit unset.
It looks like there is a check to make sure the timestamp portion only increases on a given node, but is it not possible for row ids for the same table generated on different nodes to go backward, given that their clocks may not be perfectly synced?
It seems like the probability of a collision is very low, but I’m wondering if I can depend on the monotonicity for my application. I’d like to avoid sequences if possible due to the coordination overhead, so any help here would be great. Have really enjoyed using cockroach thus far and want to make sure I’m not misunderstanding something here.
Thanks!