Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Degree of time-sort sensitivity #89

Open
Ceyword opened this issue Dec 23, 2024 · 1 comment
Open

Degree of time-sort sensitivity #89

Ceyword opened this issue Dec 23, 2024 · 1 comment

Comments

@Ceyword
Copy link

Ceyword commented Dec 23, 2024

Hello,
1- Can I rely on this implementation of ULID to always accurately generate ULIDs according to time i.e. if I generate many within the same millisecond, from different machines (in a distributed fashion) will they all be accurately time-sorted?
2- If the answer is yes, will the string format achieve the same time-sort sensitivity? The plan is to generate them, then store in a database as strings, to be time-sorted.
Thank you in advance.

@Ceyword Ceyword changed the title Degree of sortability Degree of time-sort sensitivity Dec 23, 2024
@neuecc
Copy link
Member

neuecc commented Dec 23, 2024

There is no guarantee when crossing between machines, or even on the same machine when IDs are generated at truly identical timestamps.
Handling these cases correctly is a pipe dream within Ulid's specifications.
For proper timestamp handling, you should read the papers on Spanner and TiDB.
In any case, this is beyond the scope of this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants