Hi The first question is bout `hint`, and the second one is `defaultDatbaseStrategy`. Let me give more explanation one by one.
## Hint I am sorry `ModuloHintShardingAlgorithm` is not a proper example, but the key point of `hint` is your sharding values which decide SQL routing come from `hintManager`, rather than `SQL`. You can refer to [1] to learn more. ## DefaultDatbaseStrategy Once there is no specific `DatbaseStrategy` for some logic tables, `DefaultDatbaseStrategy` will take effect. Sometimes a user is going to use `DefaultDatbaseStrategy` for many logic tables so as not to configure specific `DatbaseStrategy` one by one. You know, it will take a lot of time. Thanks. [1] https://shardingsphere.apache.org/document/current/en/features/sharding/other-features/sharding-hint/ Best, trista Juan Pan (Trista) Senior DBA & PPMC of Apache ShardingSphere(Incubating) E-mail: panj...@apache.org On 04/20/2020 23:54,Sun Kane<kane....@outlook.com> wrote: hi there today I got a confusion about the usage of hint , hope someone could help to explian. as followings are parts of configuration for hint in shardingsphere example : shardingRule: tables: t_order: actualDataNodes: ds_${0..1}.t_order_${0..1} databaseStrategy: hint: algorithmClassName: org.apache.shardingsphere.example.hint.raw.jdbc.ModuloHintShardingAlgorithm tableStrategy: hint: algorithmClassName: org.apache.shardingsphere.example.hint.raw.jdbc.ModuloHintShardingAlgorithm after I got the code for ModuloHintShardingAlgorithm, I realized this is so similar as `inline` , I'm not sure why not use inline instead of this strategy . public Collection<String> doSharding(final Collection<String> availableTargetNames, final HintShardingValue<Long> shardingValue) { Collection<String> result = new ArrayList<>(); for (String each : availableTargetNames) { System.out.println("each is : "+each); System.out.println("sharding value is : "+shardingValue); for (Long value : shardingValue.getValues()) { if (each.endsWith(String.valueOf(value % 2))) { result.add(each); } } } return result; } until I encount following settings hintManager.addDatabaseShardingValue("t_order", 1L); hintManager.addTableShardingValue("t_order", 1L); so , here is my confusion , the `HintShardingValues` that set by hintManager will paticipate in the Sharding Process, I still don't understand what kind of situation will use this kind of strategy ? If I set a collections to TableShardingValue, what does that use for ? and another question is , when or how the `defaultDatbaseStrategy` and `defaultTableStrategy` will be triggered since I already set up the DatabaseStrategy and TalbeStrategy anybody could help will be grateful