sivaraman-27 commented on issue #28733:
URL:
https://github.com/apache/shardingsphere/issues/28733#issuecomment-1760737051
Added some info below: (The tables below are just for example representation)
**Tables involved:**
- shard_lookup
- orders
- order_details
- order_ratings
shard_lookup:
| order_id | shard_no |
| ------------- | ------------- |
| 1 | 1 |
| 2 | 1 |
| 3 | 2 |
| 4 | 2 |
orders: [This table is present in shard_no = 1]
| order_id | user_id | order_amount
| --------- | -------- | ---------------- |
| 1 | 100 | $8 |
| 2 | 101 | $10 |
order_details: [This table is present in shard_no = 1]
| order_id | restaurant_id | ordered_on | delivered_on
| --------- | -------- | ---------------- | ----------------- |
| 1 | 8001 | epoch_time | epoch_time |
| 2 | 8002 | epoch_time | epoch_time |
order_ratings: [This table is present in shard_no = 1]
| order_id | rating_value | rated_on | will_recommed_to_others
| --------- | -------- | ---------------- | ----------------- |
| 1 | 5 | epoch_time | Yes |
| 2 | 4 | epoch_time | Yes |
* The tables above are present in shard_no = 1. Assume these tables with
same name and structure is present in all shards.
* So, for querying any data from 'orders', 'order_details', 'order_ratings',
first correct shard is obtained from 'shard_lookup' using order_id, then
appropriate table is queried.
**Examples:**
1. For getting amount for order_id = 1, below steps are followed
* Query 'shard_lookup' for order_id = 1, which gives shard_1
* Go to shard_1, query 'orders' table for order_id = 1 which will give
'$8'
2. For getting amount for order_id = 4, below steps are followed
* Query 'shard_lookup' for order_id = 4, which gives shard_2
* Go to shard_2, query 'orders' table which will give appropriate amount
* I know I can write custom logic, but just wanted to know if apache
shardingsphere/proxy will be helpful because you guys would have solved lots of
common problems.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]