That's a good question. Citus does not currently provide a direct way to change the type of shared data.
In the breakdown by ranges, records are placed in fragments in accordance with their value in the section column and min / max values. If the record x is in the shard y, then this means y.minvalue <= x.partition_column <= y.maxvalue .
In the hash, the partition column is hashed, and the entries are routed according to this hashed value. Therefore, the min / max values ββthat you see in pg_dist_shard are the boundary values ββfor the result of the hash function. In this case, y.minvalue <= hash(x.partition_column) <= y.maxvalue .
Therefore, your changes will result in incorrect distribution. To switch from a range partition to a hash partition, data must be redistributed. For this, I suggest reloading the data into an empty hash-partitioned table.
For more information, you can refer to Working with Distributed Tables and Hash Distribution in the Citus Documentation Section.
source share