1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
Added a possibility not to factor out the condition pushed to
the access index out of the condition pushed to a joined table.
This is useful for the condition pushed to the index when a hashed
join buffer for BKA is employed. In this case the index condition
may be false for some, but for all records with the same key.
So the condition must be checked not only after index lookup,
but after fetching row data as well, and it makes sense not to 
factor out the condition from the condition checked after reading
row data,
The bug happened because the condition pushed to an index always
was factor out from the condition pushed to the accessed table.
This commit is contained in:
Igor Babaev
2010-10-01 10:08:10 -07:00
parent 21b1b5f040
commit 1320f6073c
5 changed files with 91 additions and 14 deletions

View File

@@ -272,12 +272,14 @@ Item *make_cond_remainder(Item *cond, bool exclude_index)
in tab->select_cond
keyno Index for which extract and push the condition
other_tbls_ok TRUE <=> Fields of other non-const tables are allowed
factor_out TRUE <=> Factor out the extracted condition
DESCRIPTION
Try to extract and push the index condition down to table handler
*/
void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok)
void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok,
bool factor_out)
{
DBUG_ENTER("push_index_cond");
Item *idx_cond;
@@ -350,7 +352,8 @@ void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok)
if (idx_remainder_cond != idx_cond)
tab->ref.disable_cache= TRUE;
Item *row_cond= make_cond_remainder(tab->select_cond, TRUE);
Item *row_cond= factor_out ? make_cond_remainder(tab->select_cond, TRUE) :
tab->pre_idx_push_select_cond;
DBUG_EXECUTE("where",
print_where(row_cond, "remainder cond", QT_ORDINARY););