Skip to content

Instantly share code, notes, and snippets.

@spetrunia
Created May 27, 2022
Embed
What would you like to do?
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 21e12ffae34..47e74291bf4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5399,6 +5399,17 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
}
}
+ {
+ for (JOIN_TAB *s= stat ; s < stat_end ; s++)
+ {
+ TABLE_LIST *tl= s->table->pos_in_table_list;
+ if (tl->embedding && tl->embedding->sj_subq_pred)
+ {
+ s->key_dependent2= tl->embedding->original_subq_pred_used_tables;
+ }
+ }
+ }
+
if (thd->trace_started())
trace_table_dependencies(thd, stat, join->table_count);
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 6807faff30f..18c322659a1 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -358,6 +358,7 @@ typedef struct st_join_table {
double partial_join_cardinality;
table_map dependent,key_dependent;
+ table_map key_dependent2;
/*
1 - use quick select
2 - use "Range checked for each record"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment