1. Precise sharding algorithm
Precise Sharding Algorithm Precise Sharding Algorithm (= and IN statement), used to handle = and IN sharding scenarios that use a single key as the sharding key. Need to be used with StandardShardingStrategy
2. Range sharding algorithm
The range sharding algorithm (RangeShardingAlgorithm) is used to handle sharding scenarios using BETWEEN AND with a single key as the sharding key. Need to be used with StandardShardingStrategy.
3. Composite sharding algorithm
The compound sharding algorithm (ComplexKeysShardingAlgorithm) is used for sharding operations in which multiple fields are used as sharding keys. The values of multiple sharding keys are obtained at the same time, and business logic is processed based on multiple fields. Need to be used under ComplexShardingStrategy.
4. Hint sharding algorithm
Hint sharding algorithm (HintShardingAlgorithm) is slightly different. In the above algorithm, we parse the statement to extract the sharding key, and set the sharding strategy for sharding. But sometimes we do not use any sharding keys and sharding strategies, but if we still want to route SQL to the target database and table, we need to specify the target database and table information of SQL through manual intervention, which is also called forced routing.