How does KSQL update table's records?

I read this article https://docs.confluent.io/current/ksql/docs/developer-guide/aggregate-streaming-data.html. And it seems I don't understand one thing.

In example with COUNT KSQL updates records when new messages arrive. That means that KSQL knows how to find the certain record so as to update it. There is a query for that:

CREATE TABLE pageviews_per_region AS
  SELECT regionid,
         COUNT(*)
  FROM pageviews
  GROUP BY regionid
  EMIT CHANGES;

Is that column name in GROUP BY clause that helps KSQL find the certain record?

Upvotes: 0

Views: 1674

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191681

That means that KSQL knows how to find the certain record so as to update it

Yes, because all streams and tables have an inherent schema, their fields are named.

The GROUP BY clause operates the same as any similar SQL query in that it defines the aggregate projection, and the COUNT is the aggregate function over the projection

Upvotes: 1

Related Questions