You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/10/19 10:31:41 UTC

[GitHub] [shardingsphere] ssjsyswa opened a new issue #13150: 自定义分库策略,自定义分表策略后,范围查询,库表笛卡尔积

ssjsyswa opened a new issue #13150:
URL: https://github.com/apache/shardingsphere/issues/13150


   项目简介:  
   库名: a1,a2.
   a1库表名 :  a1_1,2,3,4.
   a2库表名:   a2_1,2,3,4.  
   规则:   按照时间规则分库分表插入.按年分库, 按季度分表.
   期望:   时间范围查找时, 比如跨年. 查表 希望的是 a1_4, a2_1, a2_2.
   出现问题: 给我把过滤出来的库和表做了笛卡尔积, 实际查询的表变成了 a1_1,a1_2, a2_1, a2_2.
   配置如下:
   
   `
     shardingsphere:
       props:
         sql:
           show: true
       datasource:
         dbipg-2021:
           driver-class-name: com.mysql.cj.jdbc.Driver
           type: com.alibaba.druid.pool.DruidDataSource
           url: jdbc:mysql://172.18.21.203:3306/dbipg-2021?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
           username: flypay_dev
           password: Flypay@2021!
         dbipg-2022:
           driver-class-name: com.mysql.cj.jdbc.Driver
           url: jdbc:mysql://172.18.21.204:3306/dbipg-2022?useSSL=false&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
           type: com.alibaba.druid.pool.DruidDataSource
           username: root
           password: password
         names: dbipg-2021,dbipg-2022
   #    mode:
   #      overwrite: true
   
       sharding:
         binding-tables: transaction_request
         tables:
           transaction_request:
             actual-data-nodes: dbipg-$->{2021..2022}.transaction_request_$->{1..4}
             database-strategy:
               standard:
                 precise-algorithm-class-name: com.paywharf.ordershadingjdbcdemo.algorithm.DBShardingAlgorithm
                 range-algorithm-class-name: com.paywharf.ordershadingjdbcdemo.algorithm.RangeDataBaseShardingAlgorithm
                 sharding-column: req_initiate_date
             key-generator:
               column: id
               props:
                 worker:
                   id: 123
               type: SNOWFLAKE
             table-strategy:
               standard:
                 precise-algorithm-class-name: com.paywharf.ordershadingjdbcdemo.algorithm.TableShardingAlgorithm
                 range-algorithm-class-name: com.paywharf.ordershadingjdbcdemo.algorithm.RangeTableShardingAlgorithm
                 sharding-column: req_initiate_date`
   
   RangeDataBaseShardingAlgorithm.doSharding 返回的是 a1,a2库 .   
   RangeTableShardingAlgorithm.doSharding 返回的是 _1, _2,_4.
   
   请问 如何避免库与表的 笛卡尔积
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang closed issue #13150: 自定义分库策略,自定义分表策略后,范围查询,库表笛卡尔积

Posted by GitBox <gi...@apache.org>.
RaigorJiang closed issue #13150:
URL: https://github.com/apache/shardingsphere/issues/13150


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] zjcnb commented on issue #13150: 自定义分库策略,自定义分表策略后,范围查询,库表笛卡尔积

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #13150:
URL: https://github.com/apache/shardingsphere/issues/13150#issuecomment-946624966


   @ssjsyswa  Hi, only support English ask questions, Can you adjust this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org