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 2022/12/28 07:26:23 UTC

[GitHub] [shardingsphere] pengxianggui commented on issue #23128: In the official demo, if I have to use order_time as the sharding field, how do I use the binding table to avoid the Cartesian product?

pengxianggui commented on issue #23128:
URL: https://github.com/apache/shardingsphere/issues/23128#issuecomment-1366430239

   > If you don't need to shard tables by `order_id`, and all tables sharding by `order_time`, then these tables could be binding tables.
   
   As you said, does the following sql have cartesian product problems?
   > The only sharding field for both tables is order_time, and the binding table is configured correctly. Notice that I haven't added a time condition to the left join clause. I'm using version ShardingSphere-JDBC 5.1.1
   ```sql
   select o.* from t_order o 
   left join t_order_item oi on o.order_id = oi.order_id 
   where o.order_time > xxx and o.order_time < yyyy
   ```
   
   如你所说,下面这条sql会出现笛卡尔积问题吗?
   > 两个表的分片字段都是order_time, 并且正确配置了绑定表。注意, 我并没有在left join 子句里添加时间条件。我正在使用的版本是ShardingSphere-JDBC 5.1.1


-- 
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