-1

I am working with Citus-Postgress to setup a cluster of coordinator and worker nodes and distribute table data across these nodes. By default, Citus uses its own logic to automatically distribute shards across the worker node.

However, I would like to manually specify the worker node to place the shard with a specific value. For instance, I have a table "user" that has columns like first_name, last_name, etc along with a column "region". The "region" column can have 4 values (int or string) for each region like ca, us, au, eu. I have 4 worker nodes for each region and I would like to place the user record in the correct worker node based on "region" column.

Is there any way you can define your own distribution logic in citus and route these shards accordingly. I would avoid putting this logic in application layer.

Gagandeep Singh
  • 827
  • 1
  • 7
  • 11

1 Answers1

0

Citus has introduced a novel sharding method that allows you to shard your database based on schemas. By assigning one region to one schema, all data from that region will reside on a single worker node. However, this approach restricts each region to a single node, meaning that if you have 4 regions, the data can only be distributed across 4 machines.

See https://www.citusdata.com/updates/v12-0/#distributed_schema for details.