summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-10-04 13:30:26 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-02-09 20:41:05 +0530
commitf8349447144255bda13e9f18d2e90dd8fe50bb3a (patch)
tree657d7a8d8f2ea78a2426e75973223ce75d236fc6
parent8e26850553246b696eb67611bd3bdd312e500949 (diff)
downloadmariadb-git-f8349447144255bda13e9f18d2e90dd8fe50bb3a.tar.gz
minor fix
-rw-r--r--sql/opt_trace.h1
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_select.h3
-rw-r--r--sql/sql_sort_nest.cc4
4 files changed, 8 insertions, 6 deletions
diff --git a/sql/opt_trace.h b/sql/opt_trace.h
index d2330420a2e..385553dc584 100644
--- a/sql/opt_trace.h
+++ b/sql/opt_trace.h
@@ -111,6 +111,7 @@ void print_best_access_for_table(THD *thd, POSITION *pos,
enum join_type type);
void add_sort_nest_tables_to_trace(JOIN *join,
Mat_join_tab_nest_info* nest_info);
+void trace_sort_nest(JOIN *join, uint idx, table_map remaining_tables);
/*
Security related (need to add a proper comment here)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 06b00b992c4..d5b02dcb09b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5355,8 +5355,6 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
}
}
- join->join_tab= stat;
- join->make_notnull_conds_for_range_scans();
/*
Here a call is made to remove the constant from the order by clause,
this call would only remove the basic constants. This is done primarily
@@ -5371,6 +5369,9 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
join->propagate_equal_field_for_orderby();
+ join->join_tab= stat;
+ join->make_notnull_conds_for_range_scans();
+
/* Calc how many (possible) matched records in each table */
/*
@@ -9715,7 +9716,6 @@ best_extension_by_limited_search(JOIN *join,
{
position->sort_nest_operation_here= TRUE;
}
->>>>>>> ORDER BY LIMIT
/* Compute the cost of extending the plan with 's' */
current_record_count= COST_MULT(record_count, position->records_read);
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 0685040612c..f94c7469884 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -2285,7 +2285,8 @@ void best_access_path(JOIN *join, JOIN_TAB *s,
table_map remaining_tables,
const POSITION *join_positions, uint idx,
bool disable_jbuf, double record_count,
- POSITION *pos, POSITION *loose_scan_pos);
+ POSITION *pos, POSITION *loose_scan_pos,
+ table_map sort_nest_tables, bool nest_created);
bool cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref);
bool error_if_full_join(JOIN *join);
int report_error(TABLE *table, int error);
diff --git a/sql/sql_sort_nest.cc b/sql/sql_sort_nest.cc
index 87773414342..857b1a172ac 100644
--- a/sql/sql_sort_nest.cc
+++ b/sql/sql_sort_nest.cc
@@ -43,7 +43,7 @@ clause.
Let's say we have tables
t1, t2, t3, t4 .............tk,tk+1.........................tn
- |<---------prefix------------>|<-------suffix--------------->
+ |<---------prefix------------>|<-------suffix--------------->|
and lets assume the prefix can resolve the ORDER BY clause and we can push
the LIMIT.
@@ -124,7 +124,7 @@ Preparation of Sort Nest
Let's say we have the best join order as:
t1, t2, t3, t4 .............tk,tk+1.........................tn
- |<---------prefix------------>|<-------suffix--------------->
+ |<---------prefix------------>|<-------suffix--------------->|
The array of join_tab structures would look like