Get Started Free
Allison

Allison Walther

Integration Architect (Presenter)

Robin Moffatt

Robin Moffatt

Principal Developer Advocate (Author)

Streams and Tables

While relational databases center around the concept of a table, ksqlDB has two first-class object types: streams and tables.

Streams are unbounded series of events, while tables are the current state of a given key.

streams-record

Both streams and tables are built from Apache Kafka topics; the difference is only the semantic interpretation of the data. Which you choose is determined by how you want to use the data.

Taking the chess board example in the graphic above, a single Kafka topic would hold the history of all the moves.

  • A ksqlDB stream on that topic would apply a schema to it, and from that you could replay some or all of the game, or identify any events involving a specific piece or square.
  • A ksqlDB table on the same topic would apply a schema to it and tell you the current location of each piece. Each time a piece moves (and a new event is written to the Kafka topic), the table updates its state.

To learn more about this important concept in the space of event streaming, see Streams and Tables in Apache Kafka: A Primer.

Use the promo code KSQLDB101 to get $25 of free Confluent Cloud usage

Be the first to get updates and new content

We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.