via PostgreSQL and UUID as primary key i stumbled upon TSID Generator, which looks interesting:

A Java library for generating Time-Sorted Unique Identifiers (TSID).
In summary:

  • Sorted by generation time;
  • It can be stored as an integer of 64 bits;
  • It can be stored as a string of 13 chars;
  • String format is encoded to Crockford's base32;
  • String format is URL safe, is case insensitive, and has no hyphens;
  • Shorter than UUID, ULID and KSUID.

also, from the comments:

Sqids is a small open-source library that can produce short, unique, random-looking IDs from numbers.
The best way to think about it is like a decimal-to-hexadecimal converter, but with a few extra features.

What is it good for?

Link shortening, generating unique event IDs for logging, generating IDs for products/objects on a website (like YouTube does for videos), generating short IDs for text messages, confirmation codes in emails, etc.

nothing's linking here.

last edited by: stefs at Monday, July 8, 2024, 12:10:12 PM Central European Summer Time

edit history source