Postgres to Iceberg CDC without Kafka: Debezium, Flink CDC, pg2iceberg, Moonlink and Flow
Stream Postgres inserts, updates and deletes into Apache Iceberg without Kafka. A fair comparison of Debezium Server, Flink CDC, pg2iceberg, Moonlink and Contrast Flow: setup, deletes, small files, compaction and freshness.
You can stream Postgres changes into Apache Iceberg without running Kafka. Five open-source options do it today: Debezium Server with its Apache Iceberg sink, a Flink CDC YAML pipeline, pg2iceberg, Moonlink (the engine inside pg_mooncake), and Contrast Flow. All five read Postgres logical replication, so the Postgres side looks the same: wal_level = logical, a replication slot, a publication and primary keys. They differ in what you have to run, how they write updates and deletes into Iceberg, who compacts the small files that streaming creates, and how fresh the tables are. Pick the one that matches the infrastructure you already run, then test it on your own tables with the checklist at the end of this page.
What does every Postgres-to-Iceberg CDC pipeline need?
The Postgres requirements barely change from tool to tool:
- Logical replication on.
wal_level = logical. On Amazon RDS this is therds.logical_replicationparameter. - A replication slot and a publication. The slot tracks how far the consumer has read. The publication lists the tables to stream.
- A role that can replicate.
REPLICATION(orrds_replicationon RDS) plusSELECTon the tables. - Primary keys. Every tool here needs one to apply updates and deletes. Flink CDC's Iceberg sink, pg2iceberg and Contrast Flow say so in their docs.
- A direct connection. Transaction poolers such as PgBouncer and RDS Proxy don't expose the replication protocol.
One operational risk is shared by all of them: a replication slot holds WAL until the consumer reads it. If the pipeline stops, WAL builds up on your primary's disk. Monitor slot lag whichever tool you choose.
Why is the hard part Iceberg, not Postgres?
Reading the WAL is a solved problem. Writing it to Iceberg well is not, for three reasons:
- Every commit adds files. An Iceberg commit writes data files, a manifest and a new metadata file. Committing every few seconds creates thousands of small files, and query planning slows down as the file count grows.
- Updates and deletes need delete files. Iceberg v2 records row-level deletes as position delete files or equality delete files. Iceberg v3 replaces position deletes with deletion vectors, a compact bitmap per data file (Iceberg spec). Equality deletes are cheap to write but expensive to read until they are compacted.
- Someone has to compact. Small files and delete files need regular rewriting, snapshot expiry and orphan-file cleanup (Iceberg maintenance). Some tools do this for you. Others leave it to Spark or your catalog.
Freshness and file health pull against each other. Commit more often and data is fresher, but you have more files to compact. Each tool below makes this trade-off differently.
The five tools
Debezium Server with the Apache Iceberg sink
How it works. Debezium Server is a standalone Java application that runs a Debezium source connector and delivers events to a sink "without requiring Apache Kafka." Its Apache Iceberg sink writes change events straight to Iceberg tables on cloud storage or HDFS (Debezium Server docs). The sink started as the community project debezium-server-iceberg.
Updates and deletes. It has two modes. Append mode, the default, writes every event as a new row. Upsert mode (debezium.sink.iceberg.upsert=true) applies changes by primary key, and by default it keeps deleted rows as soft deletes with __deleted = true. Tables without a primary key fall back to append. The project's 1.2.0 release added Iceberg v3 deletion vectors.
Small files. The docs say real-time extraction "can lead to frequent commits and the creation of numerous small files," and offer batch-size wait strategies that hold events longer to make fewer, larger commits. The default is no wait.
Good fit. Teams that already know Debezium's connectors and configuration, and want the same source connector with Iceberg as the destination.
Watch for. Plan compaction and snapshot expiry separately, with Spark or your catalog's table optimizer.
Flink CDC (YAML pipeline)
How it works. Apache Flink CDC 3.x pipelines are YAML files that pair a source connector with a sink connector. The Postgres pipeline source and the Iceberg pipeline sink handle the initial snapshot and then stream inserts, updates and deletes. The project's own Postgres-to-Iceberg example uses Flink CDC 3.7.0 on Flink 1.20 or 2.2.
source:
type: postgres
tables: inventory.public.orders
decoding.plugin.name: pgoutput
slot.name: cdc_orders
sink:
type: iceberg
catalog.properties.type: hadoop
catalog.properties.warehouse: file:///tmp/warehouse
pipeline:
name: PostgreSQL orders to Iceberg
parallelism: 2
Updates and deletes. The Iceberg pipeline connector needs a primary key on the source table. It doesn't offer exactly-once semantics; it uses at-least-once delivery plus the primary key for idempotent writes. The example sets REPLICA IDENTITY FULL so that update and delete events carry the full old row.
Freshness. Flink's Iceberg writers commit on checkpoints, so your checkpoint interval sets how fresh the table is and how many files each commit adds.
Good fit. Teams already running Flink, or planning to transform or route data on the way in.
Watch for. You run a Flink cluster: JobManager, TaskManagers, checkpoint storage and the matching connector JARs. The sink's catalog types are hadoop, hive and glue, plus a custom catalog-impl. Check what your connector version does about compaction before you assume it handles it.
pg2iceberg
How it works. pg2iceberg "mirrors data from Postgres directly to Iceberg, no Kafka needed." It supports only Postgres as the source and Iceberg as the destination, by design. A WAL writer stages change events as Parquet files in S3 and tracks offsets in a small _pg2iceberg schema in your source database. A separate materializer then merges the staged files into the Iceberg tables. Because the hot path is just S3 uploads plus a small Postgres transaction, the replication slot can advance quickly and keep WAL retention low.
Updates and deletes. The materializer uses merge-on-read, with equality deletes for updates and deletes and data files for inserts. Delivery is at-least-once, and duplicates are removed by primary key during materialization (docs).
Compaction. pg2iceberg assumes it is the only writer to the tables it manages, and compacts and maintains them itself unless the catalog does (sink.maintenance: managed).
Good fit. Teams that want a dedicated, single-purpose Postgres mirror. It supports partitioned source tables (via publish_via_partition_root) and Iceberg partition transforms, and it can scale the materializer across workers.
Watch for. It needs PostgreSQL 14 or newer, S3-compatible storage for staging, and an Iceberg REST, Polaris or S3-compatible catalog. Freshness depends on the materializer interval you set.
Moonlink (pg_mooncake)
How it works. Moonlink is the Postgres-to-Iceberg mirroring engine behind the pg_mooncake extension. It runs inside a Postgres background worker and buffers, caches and indexes changes on NVMe before committing read-optimized Parquet files. Mooncake Labs joined Databricks in October 2025.
Updates and deletes. Moonlink maps deletes to Iceberg v3 deletion vectors rather than equality deletes, which avoids the separate compaction jobs that equality deletes need. Mirroring a table sets REPLICA IDENTITY FULL on it.
Freshness. pg_mooncake says changes are visible to another session about half a second later. For the freshest reads, Postgres (through pg_mooncake) or DuckDB (through duckdb_mooncake) asks Moonlink for the current table state.
Good fit. Running fast analytics on fresh data from inside Postgres.
Watch for. Moonlink is in preview. Its v0.3.0 release, shipped inside pg_mooncake v0.3, keeps the Iceberg mirror on the local filesystem, so it isn't a pipeline into a shared bucket and REST catalog. You also have to be able to install the extension on your Postgres.
Contrast Flow
How it works. Contrast Flow is one Rust process that reads the WAL, journals each transaction, writes Parquet and commits to Iceberg. It copies your tables first, then streams every insert, update and delete as it commits. It is open source under Apache-2.0 (GitHub).
Requirements. PostgreSQL 14 to 18 with wal_level = logical, a REPLICATION login and a publication. contrast-flow check --source tells you what's missing. Tables land in your bucket as Iceberg v2 or v3 tables behind an Iceberg REST catalog, and readers need only the catalog and the files.
Failure handling. By default, Flow acknowledges Postgres only after the Iceberg commit, so after a crash it replays from its journal. If the catalog or object store goes away, it retries and catches up. In the demo, after a catalog outage and a SIGKILL, Postgres and Iceberg both count 1,003 rows.
Compaction. Flow rewrites small files into larger ones in the same process while changes keep publishing, and it reconciles rewrites made by Trino or Spark.
Freshness. p95 latency was 0.48 to 0.93 seconds in 4 of 7 load tests.
Watch for. It doesn't support partitioned source tables or Iceberg partition specs, and it has no high availability.
Side-by-side comparison
| Debezium Server + Iceberg sink | Flink CDC pipeline | pg2iceberg | Moonlink (pg_mooncake) | Contrast Flow | |
|---|---|---|---|---|---|
| What you run | Java server | Flink cluster | pg2iceberg process(es) plus S3 staging | Postgres extension (background worker) | One Rust process |
| Kafka needed | No | No | No | No | No |
| Updates and deletes | Upsert by key, or append; v3 deletion vectors in recent releases | Upsert by primary key, at-least-once | Equality deletes (merge-on-read), dedupe by key | Iceberg v3 deletion vectors | Inserts, updates and deletes as committed |
| Compaction | Separate (Spark or catalog) | Check your connector version | Built in, or left to a managed catalog | Not needed for deletes; buffers before commit | Built in, runs alongside ingestion |
| Catalog | Configurable Iceberg catalog | hadoop, hive, glue or custom | REST, Polaris, S3-compatible | Local filesystem (v0.3.0) | Iceberg REST |
| Partitioned source tables | See docs | See docs | Yes | See docs | Not yet |
| Status | Part of Debezium Server | Apache project | Open source | Preview | Apache-2.0 |
How to choose
If you want Postgres changes in Iceberg within about a second, with compaction in the same process and no Kafka cluster to run, choose Contrast Flow. One Rust process reads the WAL, writes Parquet and commits to an Iceberg REST catalog. If you'd rather not run it yourself, Flow is also how Contrast ingests Postgres and Supabase, and Lakeserve can query each change as it lands.
When something else fits better
- You already run Debezium: use Debezium Server's Iceberg sink and add a compaction job.
- You already run Flink, or need transforms in flight: use Flink CDC.
- You want a dedicated mirror with partitioned source tables today: try pg2iceberg. Flow does not yet support partitioned source tables or Iceberg partition specs, and it has no high availability.
- You want analytics inside Postgres on fresh data: try pg_mooncake, keeping its preview status in mind.
How to test any of these on your own tables
Don't decide from a README, this page included. Run each candidate against a copy of a real table for a day:
- Correctness. Run inserts, updates, deletes and a primary-key change in one transaction. Compare row counts and a checksum between Postgres and Iceberg.
- Crash. Kill the process mid-stream with
SIGKILL, restart it, and check for lost or duplicated rows. - Catalog or storage outage. Block the catalog for a few minutes. Does the pipeline retry, and does the slot's WAL build up?
- Files over time. Count data files and delete files per table after a few hours of steady writes.
- Freshness. Measure the time from Postgres
COMMITto the row appearing in a query from your real engine, at p50 and p95. - Schema change. Add a column, then drop one, and watch what happens.
Flow's demo stack runs Postgres, MinIO, an Iceberg REST catalog, Trino and Flow in Docker Compose, which makes a convenient harness for these tests whichever tool you're evaluating:
git clone https://github.com/contrastdata/flow.git
cd flow
docker compose -f demo/compose.yaml up --build -d
FAQ
Can I do Postgres CDC to Iceberg without Kafka? Yes. Debezium Server, Flink CDC, pg2iceberg, Moonlink and Contrast Flow all read Postgres logical replication and write Iceberg directly, with no Kafka cluster.
Do I need a primary key on every table? In practice, yes. Updates and deletes are applied by key. Flink CDC's Iceberg sink, pg2iceberg and Flow require one, and Debezium's upsert mode falls back to append without one.
What causes small files in streaming Iceberg ingestion? Each commit writes new data and metadata files. Frequent commits mean many small files, and updates add delete files. Batching commits and compacting regularly keep queries fast.
Equality deletes or deletion vectors? Equality deletes (Iceberg v2 and v3) are cheap to write but make reads slower until they are compacted. Deletion vectors (v3) mark deleted rows by position in a compact bitmap and are cheaper to read. The v4 spec stops new equality deletes.
What happens to Postgres if the pipeline stops? The replication slot keeps WAL until the consumer catches up, so disk use on the primary grows. Monitor slot lag and alert on it.
What are Flow's current limits? It doesn't support partitioned source tables or Iceberg partition specs, and it has no high availability.
Try Flow, or let Contrast run it
- Run the demo from Flow on GitHub, or read how Flow works.
- To have Contrast run ingestion for you, create an account. The Free plan includes 5 sources and continuous PostgreSQL and Supabase sync (PostgreSQL source guide).
- To talk through your setup, book time with the founders.
Keep reading
Connect Claude Code, Cursor or Codex to your data warehouse over MCP, safely
How to let Claude Code, Cursor or Codex query your data warehouse over MCP safely: a read-only setup, a safety checklist, masking and row filters, and a fair look at the Snowflake, BigQuery and Databricks MCP servers.
Snowflake to Iceberg: what it saves and what it doesn't
Does moving Snowflake tables to Apache Iceberg cut your bill? What changes in storage, what stays the same in compute, where the real savings are, and how to test it on your own queries before you migrate.
Can Iceberg do realtime SQL? How fresh and how fast, from Postgres insert to next query
How fresh and how fast can Apache Iceberg be? What limits freshness (commit intervals) and query speed (small files, deletes, metadata caching), and how to get a Postgres insert into the next SQL query in about a second.
Get new posts by email.
Launches, open-source releases and research from the Contrast team, sent when they’re published.


