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/14 09:37:27 UTC
[GitHub] [shardingsphere] sandynz commented on issue #3366: Sharding-jdbc execute sql, in(x,x,x) performance issues
sandynz commented on issue #3366:
URL: https://github.com/apache/shardingsphere/issues/3366#issuecomment-943187411
I tested on master branch.
Part of `rules` configuration:
```
shardingAlgorithms:
database_inline:
props:
algorithm-expression: ds_${user_id % 3}
type: INLINE
t_order_inline:
props:
algorithm-expression: t_order_${order_id % 2}
type: INLINE
tables:
t_order:
actualDataNodes: ds_${0..2}.t_order_${0..1}
```
There're 6 shards.
Test 1:
```
Logic SQL: select * from t_order where user_id in (1) and order_id in (1)
Actual SQL: ds_1 ::: select * from t_order_1 where user_id in (1) and order_id in (1)
```
If there is only one sharding column value, it just route to `1` shard.
Test 2:
```
Logic SQL: select * from t_order where user_id in (1) and order_id in (1,2)
Actual SQL: ds_1 ::: select * from t_order_0 where user_id in (1) and order_id in (1,2) ORDER BY order_id ASC
Actual SQL: ds_1 ::: select * from t_order_1 where user_id in (1) and order_id in (1,2) ORDER BY order_id ASC
```
If there're 2 sharding column values, it route to `2` shards.
I think it's already optimized.
You could try `5.0.0-beta` for now, and `5.0.0` will be released soon.
--
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