Lesezeichen

The best UUID type for a database Primary Key - Vlad Mihalcea


Beschreibung

If you plan to store UUID values in a Primary Key column, then you are better off using a TSID (time-sorted unique identifier).

One such implementation is offered by the Hypersistence TSID OSS library, which provides a 64-bit TSID that’s made of two parts:

a 42-bit time component
a 22-bit random component

The random component has two parts:

a node identifier (0 to 20 bits)
a counter (2 to 22 bits)

The node identifier can be provided by the tsid.node system property when bootstrapping the application: -Dtsid.node="12"

Vorschau

Tags

Nutzer

  • @jil

Kommentare und Rezensionen