你好

       
请问下,使用自定义分片算法的时候,怎样可以使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]

 

Reply via email to