Skip to content

Commit 9d18373

Browse files
authored
docs: Add PostgreSQL primary key update caveat to ClickPipes FAQ (#4347)
1 parent 384429f commit 9d18373

File tree

1 file changed

+14
-0
lines changed
  • docs/integrations/data-ingestion/clickpipes/postgres

1 file changed

+14
-0
lines changed

docs/integrations/data-ingestion/clickpipes/postgres/faq.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ For more details, refer to:
5858
* [ReplacingMergeTree table engine best practices](https://docs.peerdb.io/bestpractices/clickhouse_datamodeling#replacingmergetree-table-engine)
5959
* [Postgres-to-ClickHouse CDC internals blog](https://clickhouse.com/blog/postgres-to-clickhouse-data-modeling-tips)
6060

61+
### Can I update primary key columns in PostgreSQL? {#can-i-update-primary-key-columns-in-postgresql}
62+
63+
:::warning
64+
Primary key updates in PostgreSQL cannot be properly replayed in ClickHouse by default.
65+
66+
This limitation exists because `ReplacingMergeTree` deduplication works based on the `ORDER BY` columns (which typically correspond to the primary key). When a primary key is updated in PostgreSQL, it appears as a new row with a different key in ClickHouse, rather than an update to the existing row. This can lead to both the old and new primary key values existing in your ClickHouse table.
67+
:::
68+
69+
Note that updating primary key columns is not a common practice in PostgreSQL database design, as primary keys are intended to be immutable identifiers. Most applications avoid primary key updates by design, making this limitation rarely encountered in typical use cases.
70+
71+
There is an experimental setting available that can enable primary key update handling, but it comes with significant performance implications and is not recommended for production use without careful consideration.
72+
73+
If your use case requires updating primary key columns in PostgreSQL and having those changes properly reflected in ClickHouse, please reach out to our support team at [db-integrations-support@clickhouse.com](mailto:db-integrations-support@clickhouse.com) to discuss your specific requirements and potential solutions.
74+
6175
### Do you support schema changes? {#do-you-support-schema-changes}
6276

6377
Please refer to the [ClickPipes for Postgres: Schema Changes Propagation Support](./schema-changes) page for more information.

0 commit comments

Comments
 (0)