Organize shards with citus data when tenant_id of a record is updated

188 Views Asked by At

I want to use citus data to shard my postgres database. before jumping into it i want to fully understand its behaviour in different scenarios. Although the docs explain most of the cases.

I want to know how would I go about moving data to a different shard when i update tenant_id of a record?

1

There are 1 best solutions below

0
On BEST ANSWER

Citus errors out when you try to update the value of the partition column. You can move the data with INSERT INTO ... SELECT ... followed by a DELETE FROM ... inside a transaction.