You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by xiaomingrui <xi...@ruqimobility.com> on 2021/03/25 08:01:03 UTC
自定义复合分片算法的binding-tables配置失效
你好
请问下,使用自定义分片算法的时候,怎样可以使binding-tables生效?期望order_info_ext和order_info的连表查询的分片保持一致,但是现在发现不一致。
配置如下:
order_info_ext:
# 真实表
actualDataNodes: order-s-ms.order_info_ext_s_$->{0..25}
# 分库策略
databaseStrategy:
none:
# 分表策略
tableStrategy:
complex:
# 分片字段
shardingColumns: order_id,create_time
# 自定义分片算法
algorithm-class-name: sharding.algorithm.order.config.OrderShardingAlgorithm
查询语句如下:
2021-03-25 15:38:15.117 [http-nio-12000-exec-1] INFO ShardingSphere-SQL - Actual SQL: gac-order-s-statistics ::: SELECT count(*) FROM `order_info_s_22` t
LEFT JOIN order_info_ext_s_10 t2 ON t.order_id = t2.order_id
WHERE
t.user_id
=
?
AND
t.order_id
>
? ::: [123, 0]
2021-03-25 15:38:15.117 [http-nio-12000-exec-1] INFO ShardingSphere-SQL - Actual SQL: gac-order-s-statistics ::: SELECT count(*) FROM `order_info_s_22` t
LEFT JOIN order_info_ext_s_10 t2 ON t.order_id = t2.order_id
WHERE
t.user_id
=
?
AND
t.create_time
>
? ::: [123, 1970-11-05 15:43:12]
回复:自定义复合分片算法的binding-tables配置失效
Posted by Juan Pan <pa...@apache.org>.
Hi,
English communication is required.
How to create binding tables?
- To configure the same sharding table rule for these tables
- Add bind table configuration item for them.
You will get more from examples [1].
[1] https://github.com/apache/shardingsphere/tree/master/examples
------------------------------------------------------------------------------
Juan Pan(Trista), Apache ShardingSphere PMC, Apache brpc (Incubating) IPMC
Twitter, @trista86934690
在2021年07月4日 00:34,xiaomingrui<xi...@ruqimobility.com> 写道:
你好
请问下,使用自定义分片算法的时候,怎样可以使binding-tables生效?期望order_info_ext和order_info的连表查询的分片保持一致,但是现在发现不一致。
配置如下:
order_info_ext:
# 真实表
actualDataNodes: order-s-ms.order_info_ext_s_$->{0..25}
# 分库策略
databaseStrategy:
none:
# 分表策略
tableStrategy:
complex:
# 分片字段
shardingColumns: order_id,create_time
# 自定义分片算法
algorithm-class-name: sharding.algorithm.order.config.OrderShardingAlgorithm
查询语句如下:
2021-03-25 15:38:15.117 [http-nio-12000-exec-1] INFO ShardingSphere-SQL - Actual SQL: gac-order-s-statistics ::: SELECT count(*) FROM `order_info_s_22` t
LEFT JOIN order_info_ext_s_10 t2 ON t.order_id = t2.order_id
WHERE
t.user_id
=
?
AND
t.order_id
>
? ::: [123, 0]
2021-03-25 15:38:15.117 [http-nio-12000-exec-1] INFO ShardingSphere-SQL - Actual SQL: gac-order-s-statistics ::: SELECT count(*) FROM `order_info_s_22` t
LEFT JOIN order_info_ext_s_10 t2 ON t.order_id = t2.order_id
WHERE
t.user_id
=
?
AND
t.create_time
>
? ::: [123, 1970-11-05 15:43:12]