ulid
ksuid
Our great sponsors
ulid | ksuid | |
---|---|---|
3 | 21 | |
335 | 3,519 | |
- | 2.2% | |
0.0 | 4.3 | |
10 months ago | about 1 month ago | |
Python | Go | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ulid
-
New UUID Formats from IETF
As the author of a popular ULID implementation in python[1], the spec has no stewardship anymore. The specification repo[2] has plenty of open issues and no real guidance or communication beyond language implementation authors discussing corner cases. The monotonic functionality is ambiguous (at best) and is implemented differently per-languages [3].
Functionality, UUIDv7 might be the _same_ but the hope would be for a more rigid specification for interoperability.
[1]: https://github.com/ahawker/ulid
-
Sortable Collision-Free UUIDs
Looks similar to ULID[0] (I am the author of a popular python implementation[1]).
It appears to have a similar constraint that two ID's generated within the same timestamp (ms, ns) have no strong guarantee of ordering. That might not be a deal breaker depending on your use case but something to consider.
- Usando ULIDs para criar ordem em dados não ordenados
ksuid
-
Is it bad to use short (20 chars) random strings as primary keys?
Try this instead. It's shorter than a UUID and without the dashes, so it seems to meet your requirements.
-
Very efficient Nano ID gen in Go
Also see ksuid: https://github.com/segmentio/ksuid
-
New UUID Formats
For an apples to apples comparison (at least re: Go), https://github.com/segmentio/ksuid.
-
If sequential IDs (int, bigint) are fast and small, why companies like Segment and Stripe using GUID?
But on the other hand Stripe is using IDs like ch_3L9o8x2eZvKYlo2C0UFoBfSp, in_1L9o8y2eZvKYlo2CMcdIG9aZ. I'm guessing this is prefixed GUID or something. So to store this in Postgres, I have to use textor varchar. Segment's also developed their own algorithm KSUID. And they say it's super fast with trillions of rows.
-
Any thoughts on using KSUID as primary key?
I'm quite interested in Segment's KSUID for the primary key. At the moment, I'm using UUID and auto incremented bigint in certain tables. UUIDs are ugly and big and auto incremented bigints are prone to error: When I truncate and add new data to table A, a table B which was connected to A with many-to-many relations is truncated as well. When I add 'old' data to table B accidentally, all table A ids are actually wrong but related anyway and showing wrong data instead of null.
-
how do you name your literature and permanent notes?
My literature notes are named to match the citation key in Zotero. My permanent notes are named with a semi-random but date-sortable ID called a ksuid.
-
How we used Go 1.18 when designing our Identifiers
KSUID's are sort of a cross between UUID Version 4 and Snowflake. They are 160 bits where the first 32 bits are the time the identifier was generated (to the second) and then 128 bits of random data. This makes them almost ideal for us. They are k-sortable, require no configuration, and have no collision risk because of the large amount of entropy in the random part of the id.
-
When using UUIDs to generate keys for databases, do you need to verify the UUID wasn't used before?
As a side note, one common recommendation in DynamoDB is to use ulid or ksuid instead of UUID.
-
Understanding UUIDs, ULIDs and String Representations
We use K-Sortable Globally Unique IDs: https://github.com/segmentio/ksuid
Some differences:
128 bit strongly generated payload (instead of 80 bits for ULIDs).
Only 32 bit time precision but that's wall clock time anyway.
Base62 encoded.
What are some alternatives?
pg-ulid - ULID Functions for PostgreSQL
nanoid - A tiny (130 bytes), secure, URL-friendly, unique string ID generator for JavaScript
UUID - A PHP library for generating universally unique identifiers (UUIDs).
python-ulid - ULID implementation for Python
uuid - Generate RFC-compliant UUIDs in JavaScript
Hasura - Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
python-ksuid - A pure-Python KSUID implementation
ulid-mssql - Implementation of ULID generator For Microsoft SQL Server
cuid - Collision-resistant ids optimized for horizontal scaling and performance.
sonyflake-rs - 🃏 A distributed unique ID generator inspired by Twitter's Snowflake.
FrameworkBenchmarks - Source for the TechEmpower Framework Benchmarks project
tbls - tbls is a CI-Friendly tool for document a database, written in Go.