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/10/10 06:41:00 UTC
[GitHub] [shardingsphere] cucuzi opened a new issue, #17421: How can I forced routing when I using Inline Sharding Algorithm.
cucuzi opened a new issue, #17421:
URL: https://github.com/apache/shardingsphere/issues/17421
I select two using sharding table, but sharing execute full table routing.
I thinking one reason is sql join key is not sharding key.
**SQL**
```
SELECT
bg.*
FROM
bibliography bg
JOIN ( SELECT DISTINCT b.bibliography_id AS bibliography_id FROM book b WHERE b.user_id = 1 ) b ON b.bibliography_id = bg.id
WHERE
bg.user_id = 1
```
**Actually Runing SQL**
```
SELECT
bg.*
FROM
bibliography_0 bg
JOIN ( SELECT DISTINCT b.bibliography_id AS bibliography_id FROM book_0 b WHERE b.user_id = 1 ) b ON b.bibliography_id = bg.id
WHERE
bg.user_id = 1;
SELECT
bg.*
FROM
bibliography_1 bg
JOIN ( SELECT DISTINCT b.bibliography_id AS bibliography_id FROM book_1 b WHERE b.user_id = 1 ) b ON b.bibliography_id = bg.id
WHERE
bg.user_id = 1;
SELECT
bg.*
FROM
bibliography_2 bg
JOIN ( SELECT DISTINCT b.bibliography_id AS bibliography_id FROM book_2 b WHERE b.user_id = 1 ) b ON b.bibliography_id = bg.id
WHERE
bg.user_id = 1;
```
**Expected SQL**
```
SELECT
bg.*
FROM
bibliography_1 bg
JOIN ( SELECT DISTINCT b.bibliography_id AS bibliography_id FROM book_1 b WHERE b.user_id = 1 ) b ON b.bibliography_id = bg.id
WHERE
bg.user_id = 1;
```
**Sharding Config**
```
spring:
shardingsphere:
rules:
sharding:
tables:
bibliography:
actual-data-nodes: db0.bibliography_$->{0..3}
table-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: bibliography-table-inline
key-generate-strategy:
column: id
key-generator-name: snowflake
book:
actual-data-nodes: db0.book_$->{0..3}
table-strategy:
standard:
sharding-column: user_id
sharding-algorithm-name: book-table-inline
key-generate-strategy:
column: id
key-generator-name: snowflake
sharding-algorithms:
bibliography-table-inline:
type: INLINE
props:
algorithm-expression: bibliography_$->{user_id % 3}
book-table-inline:
type: INLINE
props:
algorithm-expression: book_$->{user_id % 3}
binding-tables:
- bibliography, book
```
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] RaigorJiang closed issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
URL: https://github.com/apache/shardingsphere/issues/17421
--
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] github-actions[bot] commented on issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #17421:
URL: https://github.com/apache/shardingsphere/issues/17421#issuecomment-1272349853
Hello , this issue has not received a reply for several days.
This issue is supposed to be closed.
--
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] terrymanu commented on issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #17421:
URL: https://github.com/apache/shardingsphere/issues/17421#issuecomment-1164468067
What is your version?
--
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] github-actions[bot] closed issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
URL: https://github.com/apache/shardingsphere/issues/17421
--
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] cucuzi commented on issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
Posted by GitBox <gi...@apache.org>.
cucuzi commented on issue #17421:
URL: https://github.com/apache/shardingsphere/issues/17421#issuecomment-1166478029
> What is your version?
ShardingSphere version: 5.1.0
--
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 commented on issue #17421: How can I forced routing when I using Inline Sharding Algorithm.
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #17421:
URL: https://github.com/apache/shardingsphere/issues/17421#issuecomment-1407574888
Hi @cucuzi ,
Now you can use SQL hint in with sharding, please refer to https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/special-api/sharding/hint/#use-special-sql-comments
--
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