summaryrefslogtreecommitdiff
path: root/sql/opt_index_cond_pushdown.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_index_cond_pushdown.cc')
-rw-r--r--sql/opt_index_cond_pushdown.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/opt_index_cond_pushdown.cc b/sql/opt_index_cond_pushdown.cc
index 6a24fa95b68..51aa70fa02c 100644
--- a/sql/opt_index_cond_pushdown.cc
+++ b/sql/opt_index_cond_pushdown.cc
@@ -17,6 +17,7 @@
#include "mariadb.h"
#include "sql_select.h"
#include "sql_test.h"
+#include "opt_trace.h"
/****************************************************************************
* Index Condition Pushdown code starts
@@ -334,13 +335,12 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
than on a non-clustered key. This restriction should be
re-evaluated when WL#6061 is implemented.
*/
- if ((tab->table->file->index_flags(keyno, 0, 1) &
- HA_DO_INDEX_COND_PUSHDOWN) &&
+ if ((tab->table->key_info[keyno].index_flags & HA_DO_INDEX_COND_PUSHDOWN) &&
optimizer_flag(tab->join->thd, OPTIMIZER_SWITCH_INDEX_COND_PUSHDOWN) &&
tab->join->thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
tab->join->thd->lex->sql_command != SQLCOM_DELETE_MULTI &&
tab->type != JT_CONST && tab->type != JT_SYSTEM &&
- !tab->table->file->is_clustering_key(keyno)) // 6
+ !tab->table->is_clustering_key(keyno)) // 6
{
DBUG_EXECUTE("where",
print_where(tab->select_cond, "full cond", QT_ORDINARY););
@@ -355,6 +355,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
{
Item *idx_remainder_cond= 0;
tab->pre_idx_push_select_cond= tab->select_cond;
+ Json_writer_object trace(tab->join->thd);
+ trace.add_table_name(tab);
/*
For BKA cache we store condition to special BKA cache field
because evaluation of the condition requires additional operations
@@ -387,6 +389,7 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
idx_remainder_cond= NULL;
}
}
+ trace.add("index_condition", idx_cond);
/*
Disable eq_ref's "lookup cache" if we've pushed down an index
@@ -424,6 +427,10 @@ void push_index_cond(JOIN_TAB *tab, uint keyno)
}
else
tab->select_cond= idx_remainder_cond;
+
+ if (tab->select_cond)
+ trace.add("row_condition", tab->select_cond);
+
if (tab->select)
{
DBUG_EXECUTE("where",