liveBook · Manning

Composite key

As explained in Kafka Streams in Action, Second Edition

A composite key is a record or row identifier formed from multiple fields.

A composite key identifies an aggregated row with multiple fields. In ksqlDB, grouping by first_name, last_name, and activity creates a distinct key for each combination. section 11.2

Fitness activity leaders

Summing steps with GROUP BY first_name, last_name, activity produces one aggregate per person-and-activity combination, using those three fields as the composite key.

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains grouping, key-format failure, JSON configuration, and copying key fields into values.
Examples
Uses first name, last name, and activity to calculate per-person activity leaders from fitness events.
What it assumes
Assumes Kafka key-value records and aggregation basics while demonstrating multi-column grouping from a streaming schema.
What you can do after
Apply it via ksqlDB by selecting a schema-supporting key format and grouping on every field defining aggregate uniqueness.
How it connects
Connects composite keys with aggregation, GROUP BY, Kafka key-value records, JSON, and AS_VALUE.

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 Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.