Schema-based sharding distribution strategy.
Citus allows to customize the distribution strategy of shards by defining custom re-balance strategies, for instance moving a schema to a specific shard and giving weightage to specific nodes in node_capacity functions. But I have to trigger a rebalance frequently.
Is it possible to define a strategy during distribution time itself? whether this kind of feature already exists in citus.
More on my use case in this Q&A.
Unfortunately no. We don't provide a way to define a strategy at distribution time because today the rebalance strategy concept is based on shard ids, and when we don't have a shardid that is created already, it's not possible to define a strategy for it too.
We could add a GUC to hint the code about which node to put the schema into and implicitly define a rebalance strategy or such to prevent this schema from being moved out of that node in future rebalance operations.
If we were to implement this that way, would that help you?
Yes, that would help!. Thanks for the response.
Also, I would like to know whether is it possible to set a limit for number of shards per node could handle, like a threshold, (in schema-based sharding).