Batch, micro-batch, streaming and CDC are cost profiles, not camps. Where pipeline spend actually lands, a worked CDC to Kafka to Flink to ClickHouse and Iceberg pipeline, a decision table and a checklist for picking a pattern per data flow.
Two costs are easy to miss in a pipeline design: repeatedly transforming unchanged data and running infrastructure continuously for outputs that are read only once a day. Start with the freshness each consumer needs, then work backward to the processing pattern.
So the batch-versus-streaming question is a cost question, and it has to be answered per flow rather than per platform. A mature platform runs a nightly batch, a Kafka-fed live view and a CDC replica side by side, and that is fine. What is not fine is a nightly report fed by a 24/7 Flink job, or a "real-time" dashboard fed by a connector that polls every five minutes. This post is about telling those apart before you build them.
Where the money goes
Transformation compute can dominate a pipeline bill, but moving bytes is not universally cheap: cross-region traffic, cloud egress, private networking and connector charges can matter. For standard Snowflake warehouse sizes, a Small uses 2 credits per hour and an X-Large 16; the hourly rate is eight times higher, but the total job cost also depends on runtime. Warehouse generation, type, region and contract affect the actual charge. Check the warehouse overview and compute billing rules.
Incremental processing avoids repeating work, provided the filter captures late arrivals, corrections and deletes. dbt incremental models make the selection explicit; a timestamp filter that misses yesterday's correction is a correctness bug, even if it lowers the bill.
Duplicated batch and streaming implementations create another maintenance cost. Jay Kreps described this problem in Questioning the Lambda Architecture. Replaying a retained log through the same transformation can reduce duplication, but only if retention, historical schemas and the transformation's dependencies make that replay reproducible.
The four patterns and what decides between them
Batch processes a bounded input. Streaming processes an ongoing input, often maintaining state. Micro-batching divides that ongoing input into bounded runs. CDC describes how changes are captured from a source, so it can feed any of the other three patterns; it is not a mutually exclusive processing mode. Spark Structured Streaming documents low-latency execution modes, but those published minima are not a latency floor or a promise for an arbitrary pipeline.
| Pattern | Pick it when | Latency you actually get | What you pay for |
|---|---|---|---|
| Batch | Consumers read on a schedule (reports, ML training sets, month-end) | Minutes to hours, by design | Job compute plus provisioned idle capacity, if any |
| Micro-batch | A dashboard or feed needs "fresh enough" and you already run Spark | Often seconds to minutes; measure end-to-end lag | Always-on driver plus amortized batches |
| Streaming | Per-event decisions: fraud, alerting, feature serving | Milliseconds to seconds | 24/7 stateful cluster, checkpoints, exactly-once sinks, on-call |
| CDC | Source is an OLTP database and the target must mirror it | Depends on source, connector and sink; DMS offers no latency SLA (AWS DMS) | Change volume, plus an initial snapshot and log retention on the source |
Two things the table hides. CDC's "proportional to change volume" holds only in steady state: the initial snapshot is a full read of every captured table, and if the connector stops for long enough the source keeps write-ahead log segments around for it, which costs disk on the database (Debezium PostgreSQL connector). And streaming's price is mostly operational. Flink checkpoints require a replayable source and durable state storage (Flink checkpointing); exactly-once into Kafka means every write goes inside a Kafka transaction committed on checkpoint (Flink Kafka connector). Someone has to understand that at 3am.
One pipeline, end to end
Take an orders table in PostgreSQL. Finance wants a daily revenue rollup, ops wants a live order-status board, and data science wants three years of history to replay. Three consumers, three freshness needs, one source. Here is how the patterns compose:
- Capture once. Debezium takes a consistent snapshot of
orders, records the WAL position, then streams committed changes from that position through a logical replication slot into a Kafka topic. Monitor the slot: an idle connector pins WAL on the primary. - Live view via streaming. A Flink job consumes the topic, keys by
order_id, keeps the latest status per order, and writes to ClickHouse. Batch the sink: ClickHouse wants inserts of 10,000 to 100,000 rows because every insert creates a part that later has to be merged, and async inserts move that batching server-side if the client cannot do it (ClickHouse insert strategy). The ops board reads ClickHouse. Measure visibility lag through the connector, processing and insert stages. - History via the lakehouse. Append raw change events to Iceberg with a compatible Flink sink. Commits are coordinated with checkpoints. At one successful commit every ten seconds, a continuously active writer could create 8,640 snapshots per day; actual commits and file counts vary. Compaction rewrites small data files, while snapshot expiration is a separate maintenance operation. Keep snapshots and temporary files needed by running jobs, as the Iceberg Flink documentation warns.
- Rollups via batch. A nightly model applies changes to a revenue table. If the source contains CDC events, reconstruct order state or calculate signed adjustments before summing revenue; summing every update double-counts orders. Reprocess an explicit lookback window for late corrections. Iceberg time travel can reproduce a retained snapshot, but incremental Spark reads do not provide a general row-change feed for all updates and deletes.
Keep revenue logic in one owned model and order-status logic in one owned stream transformation. For the ClickHouse serving path, this article assumes 26.8 LTS. Define stable keys, versions and delete handling; an append-only table is not automatically a current-state replica. The Kafka, Flink and ClickHouse blueprint and Debezium production patterns cover the surrounding operations.
Anti-patterns from cost reviews
Hidden batch inside a "real-time" pipeline is the most common. A dashboard advertised as live, fed by a JDBC connector on a five-minute poll, is a micro-batch pipeline with a streaming label, and someone downstream has promised an SLA the slowest hop cannot meet. Measure end-to-end latency at the consumer before you put a number in a contract.
Streaming for slow-moving data is the most expensive. A dimension table that changes twice a day does not need Kafka, a stream processor, a schema registry and a pager rotation. A scheduled sync is simpler, and simpler is cheaper every month after launch.
Over-orchestration is the most annoying. One SQL transform wrapped in a six-task DAG with sensors, retries and branching adds surface area and no value. Orchestration earns its place when there are real cross-system dependencies.
Duplicated transforms are the most dangerous. The same business rule written once in Spark for the nightly path and again in Flink for the live path will drift, and when finance and ops disagree about yesterday's revenue, both pipelines are correct according to their own code.
The decision checklist
Ask these four questions per data flow, in order. The first one that gives a clear answer usually decides.
- How often does anyone read the output? Once a day: batch. Every few minutes: micro-batch. Per event, with a decision attached: streaming. Get the answer from whoever reads the output; producers always say "as fresh as possible".
- Does the source expose a change log? An OLTP database with WAL or binlog access: CDC, and the freshness downstream is whatever step 1 needs. A SaaS API or a file drop: batch or micro-batch, because there is nothing to tail.
- What is the slowest hop? Find it before promising latency. If it is a five-minute poll, everything after it is micro-batch no matter what runs there.
- Will you need to reprocess history? If yes, land raw events in a table format with snapshots and time travel, and keep the transform in one engine so replay uses the same code as production.
If you are choosing between these patterns for a specific workload, or trying to untangle a platform that grew three of them by accident, our data engineering team does this work. The ETL optimization field guide covers the diagnosis side, and the modern data platform guide covers the stack around it.