K-Sortable Globally Unique Identifiers (KSUID)

Introduction

KSUID is for K-Sortable Unique IDentifier. It is a kind of globally unique identifier similar to a RFC 4122 UUID, built from the ground-up to be "naturally" sorted by generation timestamp without any special type-aware logic.

In short, running a set of KSUIDs through the UNIX sort command will result in a list ordered by generation time.

There are numerous methods for generating unique identifiers, so why KSUID?

  • Naturally ordered by generation time
  • Collision-free, coordination-free, dependency-free
  • Highly portable representations

Even if only one of these properties are important to you, KSUID is a great choice! :) Many projects chose to use KSUIDs just because the text representation is copy-and-paste friendly.

Example