For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

PostgreSQL partitioned tables for CDC

How to configure Nilus CDC for PostgreSQL declarative partitioning: including parent and child tables in the capture list, publication coverage, and a worked config example.

Nilus can capture changes from PostgreSQL partitioned tables, but the setup differs slightly from a single-table CDC flow because WAL records are emitted by the physical child partitions that receive the writes.

How partitioned tables behave

PostgreSQL declarative partitioning lets applications write to a parent table while PostgreSQL routes each row to the matching child partition. For CDC, that means:

  • Applications should write through the parent table.

  • Change records are produced by the child partitions that store the rows.

  • Nilus must be configured with both the parent table and the active child partitions.

Required setup

  1. Write through the parent table

  • Application writes should target the parent table, not the partition tables directly.

  1. Keep a primary key on the parent

  • Nilus relies on a stable primary key to process updates and deletes correctly.

  1. Include the parent and all child partitions

  • table.include.list must include the parent table and every child partition that can receive writes.

  • Example:

table.include.list: "public.orders,public.orders_2024_q1,public.orders_2024_q2"
  1. Use logical replication

  • wal_level must be set to logical.

  • The replication user needs the privileges required to read the listed tables and manage publication state when applicable.

  1. Validate publication coverage

  • Your publication should cover the parent and child partitions, or use a broader publication strategy if that matches your environment.

Why snapshots look larger than expected

If you include public.orders plus two child partitions, Nilus snapshots each listed table. The initial row count therefore reflects the sum of the parent and child tables that you explicitly included.

Example table layout

Example Nilus config

Best practices

  • Keep table.include.list in sync with newly created partitions.

  • Test snapshot volume and CDC routing before production if partitions are created dynamically.

  • Monitor replication slot lag and WAL retention, especially during maintenance windows.

  • Keep topic.prefix, slot.name, and publication.name stable once the pipeline is live.

Last updated

Was this helpful?