-
Notifications
You must be signed in to change notification settings - Fork 45
2.0. COMB
Fabio Lima edited this page Sep 25, 2022
·
1 revision
Prefix COMB is a UUIDv4 that can be sorted by creation time.
Creating a Prefix COMB:
UUID uuid = UuidCreator.getPrefixComb();
Sequence and structure of Prefix COMBs:
01720b5c-bf10-47cc-b631-4f262f500172
01720b5c-bf10-42ca-b063-28d5329b8d90
01720b5c-bf10-4442-876b-2710215d41e1
01720b5c-bf11-4a08-a63f-4495659603b4 < millisecond changed
01720b5c-bf11-49a8-8339-8e3b429fc6fb
01720b5c-bf11-4879-81f9-97194a331e3f
01720b5c-bf11-497f-a599-c52a8c692107
01720b5c-bf11...
^
|-------------|----------------------|
prefix randomness
Suffix COMB is a UUIDv4 that can be sorted by creation time in MS SQL Server.
Creating a Suffix COMB:
UUID uuid = UuidCreator.getSuffixComb();
Sequence and structure of Suffix COMBs:
119a1f87-59d1-4f08-b7e9-01720b5cbf0c
d0bb8776-37fa-47d4-978f-01720b5cbf0c
867a1ec3-f8de-46ec-b3a4-01720b5cbf0c
1739a555-5a45-44fd-9331-01720b5cbf0d < millisecond changed
43d9c807-2286-4bd7-8263-01720b5cbf0d
643653e4-8ae2-43bf-be16-01720b5cbf0d
e1f40089-7cf0-42f1-a27a-01720b5cbf0d
...01720b5cbf0d
^
|-----------------------|------------|
randomness suffix
Short Prefix COMB is a UUIDv4 with a small ascending prefix that wraps around every 45 days.
Creating a Short Preffix COMB.
UUID uuid = UuidCreator.getShortPrefixComb();
Sequence and structure of Short Prefix COMBs:
2fe85dad-4e7f-4447-b035-23882d69027d
2fe810cb-fa4d-4d2c-9e4f-b122d0d19391
2fe8a8c1-b039-477b-8b63-483eb986434e
2fe839c9-b1b7-43c7-88c5-09fda1ef30e6
2fe8a971-e3ac-4f3b-858a-1aad577e8c36
2fe87c36-9e81-40c8-bff2-1bf9956c0d32
2fe86aca-f113-4ef4-8b69-1b5de35d0832
2fe8...
|----|-------------------------------|
prefix randomness
Short Suffix COMB is a UUIDv4 with a small ascending suffix (actually an infix) that wraps around every 45 days and can be used in MS SQL Server.
Creating a Short Suffix COMB:
UUID uuid = UuidCreator.getShortSuffixComb();
Sequence and structure of Short Suffix COMBs:
2d505d8f-10e6-42b3-9be3-2fe8064a65e9
d2eed78b-3277-42e4-ae58-2fe8e6f09523
5e471a1c-6cd8-4112-a9cb-2fe81873ba5f
5777ecca-471d-4926-8c71-2fe898083dc9
2c9602c6-d3e7-4cce-b687-2fe8681f205e
7cc02c02-c867-4bbb-a130-2fe87bd427cc
033d4881-f059-4171-bc83-2fe89e5a2bed
...2fe8...
|-----------------------|----|-------|
randomness suffix
Notes:
- "Prefix COMB" and "Suffix COMB" are just invented names to designate types of COMBs where the timestamp is to the left or right of the random part of the GUID. Jimmy Nilsson, who conceived the idea of the COMB GUID for SQL Server, does not use these names in his article.
- "Short Prefix COMB" and "Short Suffix COMB" are also invented names to designate types of COMBs with shorter timestamps. Tomas Vondra, who conceived the idea of Sequential UUID for PostgreSQL, does not use these names in his article.