liveBook · Manning

Universally unique identifier

As explained in ScyllaDB in Action

A UUID is a standardized 128-bit identifier format designed to provide uniqueness across systems and commonly represented as hexadecimal characters.

A universally unique identifier (UUID) identifies an entity across systems without relying on a meaningful name. Its 128-bit value is commonly displayed as 32 hexadecimal characters separated by four hyphens, producing a 36-character string. section 4.4 section 4.4.1

ScyllaDB provides two related identifier types:

  • UUID supplies a predominantly random identifier, typically corresponding to version 4. Its 122 random bits make collisions extremely unlikely, although not mathematically impossible. section 4.4.1
  • TIMEUUID supplies a version 1 identifier containing a timestamp. ScyllaDB can sort it temporally, making it useful for recent-first results and conflict-free primary keys. section 4.4.1
  • ScyllaDB generates UUID values with uuid() and TIMEUUID values with now(); applications may instead generate identifiers when they need to know the value immediately. section 4.4.1 section 4.7

Choosing IDs for restaurant reviews

A restaurant-review application can use TIMEUUID for article IDs, article-summary IDs, and author IDs. The embedded time lets queries sort article summaries by recency and helps express when related data was created. A plain UUID is sufficient when the application needs only a quick random identifier. section 4.4.2

cqlsh: types> INSERT INTO basic(text, uuid, timeuuid)
  VALUES ('uuids', uuid(), now());

See UUID and TIMEUUID generated directly in CQL with uuid() and now(). section 4.4.1

How ScyllaDB in Action covers it

How deep it goes
Explains formatting, binary storage, randomness, temporal ordering, generation functions, and selection trade-offs; defers detailed UUID versions.
Examples
Demonstrates uuid() and now() in CQL and assigns TIMEUUID values to article, summary, and author identifiers.
What it assumes
Assumes requirements-driven data modeling and primary-key concepts while introducing UUID representation and generation from the basics.
What you can do after
Operate/configure ScyllaDB identifiers by choosing UUID or TIMEUUID and generating values with CQL or application code.
How it connects
Connects UUIDs with TIMEUUID, primary keys, partition keys, temporal sorting, and query-first data modeling.

Also explained in

Compare how 10 books explain universally unique identifier →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.