Is it bad to use short (20 chars) random strings as primary keys?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • ksuid

    K-Sortable Globally Unique IDs

  • Try this instead. It's shorter than a UUID and without the dashes, so it seems to meet your requirements.

  • ulid

    Universally Unique Lexicographically Sortable Identifier (ULID) in Go

  • I'm not concerned too much about the performance or the storage size at this stage. I've checked ulids before posting (more specifically https://github.com/oklog/ulid) but the only difference than a random string (especially if you use them with math.rand) is the timestamp prefix which makes them sortable, but I don't need that (users could use the internal SQLite rowid if they needed to sort by a primary key).

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts