Created
March 6, 2023 15:33
-
-
Save spetrunia/d89849d990ce0fa549acaa91fe9cc912 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc | |
index b971c96cda2..3b6ec949ea3 100644 | |
--- a/sql/opt_subselect.cc | |
+++ b/sql/opt_subselect.cc | |
@@ -3964,6 +3964,12 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join) | |
Json_writer_object semijoin_strategy(thd); | |
semijoin_strategy.add("semi_join_strategy","FirstMatch"); | |
Json_writer_array semijoin_plan(thd, "join_order"); | |
+ | |
+ bool one_table_and_buffer_allowed= false; | |
+ if (first == tablenr && // one table | |
+ optimizer_flag(join->thd, OPTIMIZER_SWITCH_SEMIJOIN_WITH_CACHE)) | |
+ one_table_and_buffer_allowed= true; | |
+ | |
for (idx= first; idx <= tablenr; idx++) | |
{ | |
Json_writer_object trace_one_table(thd); | |
@@ -3971,7 +3977,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join) | |
{ | |
trace_one_table.add_table_name(join->best_positions[idx].table); | |
} | |
- if (join->best_positions[idx].use_join_buffer) | |
+ if (join->best_positions[idx].use_join_buffer && | |
+ !one_table_and_buffer_allowed) | |
{ | |
best_access_path(join, join->best_positions[idx].table, | |
rem_tables, join->best_positions, idx, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment