Use cases

Database change streams (CDC)

Turn change data capture streams into queryable event history for analytics, automation, and agents.

Database change streams (CDC)

Use RawTree for change data capture (CDC) when the history of what changed matters as much as the current row. Stream inserts, updates, deletes, and snapshots into RawTree, keep the original change records, and query them with SQL as soon as they arrive.

This is useful when you want analytics or automation without building a warehouse pipeline first. Land the raw operational changes first, then let dashboards, scripts, and agents inspect the event log directly.

CDC also fits RawTree because it keeps each system doing the job it is good at: your OLTP database remains the source of truth for transactional reads and writes, while RawTree stores the change stream so you can reconstruct the latest table state and run analytics on top of it.

Where it fits

CDC is a good fit for systems that need to answer questions over change history:

  • Which customers, orders, or accounts changed during a window?
  • What did a row look like before and after an update?
  • Which source operations produced a downstream anomaly?
  • How do you rebuild the latest state from an append-only stream?

Keep one RawTree table per source entity or event family. For example, a Postgres orders table can map to an orders_cdc table, while MongoDB collections can map to tables such as mongo_orders and mongo_users.

What to store

Preserve the source payload and add enough metadata to make the stream self-describing:

  • The operation type, such as insert, update, replace, or delete.
  • The source timestamp or log position.
  • The source database, schema, table, collection, or namespace.
  • The primary key or document ID.
  • Before and after values when the source can provide them.

RawTree stores the raw row shape, so you can start with the records your connector already emits and refine queries later.

Start with

  1. Pick the source table or collection you want to replicate.
  2. Send the initial snapshot and ongoing change events into a RawTree table.
  3. Query counts by operation to confirm the stream is moving.
  4. Build state-reconstruction or audit queries on top of the event log.

Examples