2095
Try to extract and push the index condition
2099
tab A join tab that has tab->table->file and its condition
2101
keyno Index for which extract and push the condition
2102
other_tbls_ok true <=> Fields of other non-const tables are allowed
2105
Try to extract and push the index condition down to table handler
2107
void push_index_cond(JoinTable *tab, uint32_t keyno, bool other_tbls_ok)
2110
if (tab->table->file->index_flags(keyno, 0, 1) & HA_DO_INDEX_COND_PUSHDOWN &&
2111
tab->join->session->variables.engine_condition_pushdown)
2113
idx_cond= make_cond_for_index(tab->select_cond, tab->table, keyno,
2118
tab->pre_idx_push_select_cond= tab->select_cond;
2119
Item *idx_remainder_cond= tab->table->file->idx_cond_push(keyno, idx_cond);
2122
Disable eq_ref's "lookup cache" if we've pushed down an index
2124
TODO: This check happens to work on current ICP implementations, but
2125
there may exist a compliant implementation that will not work
2126
correctly with it. Sort this out when we stabilize the condition
2129
if (idx_remainder_cond != idx_cond)
2130
tab->ref.disable_cache= true;
2132
Item *row_cond= make_cond_remainder(tab->select_cond, true);
2136
if (!idx_remainder_cond)
2137
tab->select_cond= row_cond;
2140
tab->select_cond= new Item_cond_and(row_cond, idx_remainder_cond);
2141
tab->select_cond->quick_fix_field();
2142
((Item_cond_and*)tab->select_cond)->used_tables_cache=
2143
row_cond->used_tables() | idx_remainder_cond->used_tables();
2147
tab->select_cond= idx_remainder_cond;
2150
tab->select->cond= tab->select_cond;
2158
2095
cleanup JoinTable.
7569
7506
else if (tab->select && tab->select->quick)
7570
7507
keyno = tab->select->quick->index;
7572
if (keyno != MAX_KEY && keyno == table->file->pushed_idx_cond_keyno &&
7573
table->file->pushed_idx_cond)
7574
extra.append(STRING_WITH_LEN("; Using index condition"));
7576
7509
if (quick_type == QUICK_SELECT_I::QS_TYPE_ROR_UNION ||
7577
7510
quick_type == QUICK_SELECT_I::QS_TYPE_ROR_INTERSECT ||
7578
7511
quick_type == QUICK_SELECT_I::QS_TYPE_INDEX_MERGE)
7610
7543
else if (tab->select->cond)
7612
const COND *pushed_cond= tab->table->file->pushed_cond;
7614
if (session->variables.engine_condition_pushdown && pushed_cond)
7616
extra.append(STRING_WITH_LEN("; Using where with pushed "
7618
if (session->lex->describe & DESCRIBE_EXTENDED)
7620
extra.append(STRING_WITH_LEN(": "));
7621
((COND *)pushed_cond)->print(&extra, QT_ORDINARY);
7625
extra.append(STRING_WITH_LEN("; Using where"));
7545
extra.append(STRING_WITH_LEN("; Using where"));