Improvement on subquery handling in ShardingRouteDecorator
See original GitHub issueRequisites
- Have the basic learning about
ShardingStatementValidator
- Java coding
Aim-1
- This issue is to do some refactoring works to make the subquery validating cohesive.
How-1
- Create a class
ShardingSelectStatementValidator
implementsShardingStatementValidator
. - Move the content of
checkSubqueryShardingValues
inShardingRouteDecorator
to the preValidate ofShardingSelectStatementValidator
.
Once How-1
finishes, you can raize a PR. Moreover, there is a further to-do for Aim-2.
Aim-2
- Review the validating logic and make all the subqueries in the
one database instance
run well. FYI, currently, subquery only with the same sharding key can work well, which limits the subquery supported scope where we can reach.
How-2
- Review the preValidate function and fill the postValidate function in
ShardingSelectStatementValidator
to make the subqueries SQL routed in the same instance work well. - Fix the @Ignore tests in
SubqueryRouteTest
- Add a test case with a subquery SQL containing different sharding column names, like using order_id and item_id together.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Writing Subqueries in SQL | Advanced SQL - Mode Analytics
This lesson of the SQL tutorial for data analysis covers using subqueries ... Subqueries can be very helpful in improving the performance of...
Read more >How to improve sub query performance in MySQL
When using sub queries, MySQL performance sucks. I have to find a better way to write my queries by analyzing them using the...
Read more >Subqueries (SQL Server) - Microsoft Learn
A subquery is a query that is nested inside a SELECT , INSERT , UPDATE , or DELETE statement, or inside another subquery....
Read more >Subquery vs. CTE: A SQL Primer - LearnSQL.com
SQL subqueries and CTEs seem similar, but even pros may not know all their quirks. Learn their similarities, differences, and best use ...
Read more >13.2.10.10 Optimizing Subqueries - MySQL :: Developer Zone
Use subquery clauses that affect the number or order of the rows in the subquery. For example: SELECT * FROM t1 WHERE t1.column1...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@strongduanmu hi, I’ve modified the codes according to your suggestion.
@wgy8283335 Welcome ! 👍