liveBook · Manning

Composite key

As explained in ScyllaDB in Action

A composite primary key is a primary key formed from multiple columns whose combined values identify a row.

A composite primary key combines multiple columns to identify a row. In ScyllaDB, its first component becomes the partition key, while additional components help organize rows within that partition. section 3.3.2

Choose the columns by tracing the queries the table must support:

  • Put the query’s grouping value first so related rows share a partition instead of forcing a cross-partition query. section 3.3.2

Restaurant reviews

A review table can define PRIMARY KEY (restaurant, ordered_at, food). This groups reviews by restaurant and orders them by timestamp and food within each restaurant partition.

How ScyllaDB in Action covers it

How deep it goes
Explains key order, partition selection, query consequences, and a CQL definition, but does not detail internal hashing.
Examples
Demonstrates article-summary tables, restaurant reviews, author grouping, date grouping, and score grouping.
What you can do after
Apply it via ScyllaDB CQL by ordering key columns around required query patterns and partition boundaries.
How it connects
Connects composite primary keys with partition keys, clustering order, denormalization, and query-driven data modeling.

Also explained in

Compare how 8 books explain composite key →

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.