- Kafka: the stream binds to a topic and tracks consumer offsets per partition.
- Postgres: the stream binds to a table and owns a logical replication slot on the source. See the Postgres CDC guide.
- MongoDB: the stream binds to a collection and tracks a change-stream position. See the MongoDB CDC guide.
READ_STREAM. Postgres and MongoDB streams are usually consumed by a CDC table, which applies the changes continuously. Stream metadata is visible in information_schema.streams.
Kafka streams
Kafka stream types
For
RAW_TEXT and BINARY stream types, define a single column named data with the matching type.Postgres streams
CREATE STREAM connects to the source and creates the stream’s logical replication slot. It rejects a publication that does not publish insert, update, delete and truncate or filters the table’s rows, and a partitioned table or a table other tables inherit from; see Partitioned source tables.
MongoDB streams
A MongoDB stream takes no column list. Its columns are always
_id TEXT NOT NULL, the document’s _id rendered as Extended JSON, and doc JSON, the whole document after the change (NULL for a delete). See Read raw change events.
CREATE STREAM connects to the deployment, checks the source prerequisites, and records the current end of the collection’s change stream as the stream’s starting position. It fails if the deployment cannot be reached or a prerequisite is not met.
ALTER STREAM
ALTER STREAM applies to Kafka streams only. For Postgres and MongoDB streams, schema changes are drop-and-recreate.
Reposition a Kafka stream’s consumer offset on a partition:
DROP STREAM
- Kafka: none; the topic is untouched.
- Postgres: the stream’s replication slot (or slots, for a partitioned source) is dropped on the source, so it stops retaining WAL. If the source is unreachable, the stream is still dropped and the error message names the leftover slot for manual removal.
- MongoDB: none; change streams hold no server-side resource.
information_schema.cdc_ingests.
Related
READ_STREAM: read data from a stream.- CREATE CDC TABLE: apply a change stream continuously.
information_schema.streams: stream metadata and consumer offsets.- Change data capture: concepts and guides.