TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: ULID or CUID2 for B2B Startup?

2 pointsby superjose8 months ago
I saw this after installing the Temporal.io client: https:&#x2F;&#x2F;github.com&#x2F;paralleldrive&#x2F;cuid2<p>What should I use for a startup going after B2B sales?<p>ULIDs or CUID2s for primary keys?<p>I remember seeing Hussein Nasser&#x27;s Shopify video: https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=f53-Iw_5ucA<p>And it made me switch to using ULIDs instead.<p>I know this may fall into the &quot;premature optimization is the root of all evils&quot; category. But since it&#x27;s straightforward, what should I do?<p>I&#x27;ve been using ULIDs in distributed systems with no problems so far.

1 comment

potamic8 months ago
ULIDs are time ordered and CUID2s are random. So your decision should really be based on whether you want ordered IDs are not. Ordering is useful for transactional entities because you tend to operate on recent entities much more than older ones and things like partitioning, indexing become easier, whereas for non-transactional long lived entities, it might not matter much. Some applications don&#x27;t like to leak time information through their IDs so they choose random IDs.<p>There is also UUIDv7 now which is similar to ULID but UUID compatible and might be a more ubiquitous standard going forward.