News for hackers. Stuff that matters.
Re:ULID: Like UUID but Sortable (2019) by thih9 on Sunday July 14, 2024 @02:24AM (#40959229)
It says both:

> Within the same millisecond, sort order is not guaranteed

And:

> Monotonic sort order (correctly detects and handles the same millisecond)

Which is it?

To make it more confusing, the spec later contains a section about monotonic sort order[1]. And looks like not all libraries implement it [2].

[1]: https://github.com/ulid/spec?tab=readme-ov-file#monotonicity

[2]: https://github.com/suyash/ulid/issues/10

Re:ULID: Like UUID but Sortable (2019) by lukevp on Sunday July 14, 2024 @02:30AM (#40959248)
I think it’s meant to be monotonic within one node but not cross-node (cross-node the sort order is random within the same millisecond). The random portion of the IDs are sequentially incrementing within a single MS on a given node.
Re:ULID: Like UUID but Sortable (2019) by GeertJohan on Sunday July 14, 2024 @02:30AM (#40959245)
Afaik it depends on the generate function you use. You can let it keep track of the increment when generating, at a performance cost (atomic operations).
Re:ULID: Like UUID but Sortable (2019) by jakjak123 on Sunday July 14, 2024 @05:19AM (#40959837)
I think it means all ids from the same node will be monotonic, ie it will never generate a id that will be sorted before an earlier one