1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

5.3 merge

This commit is contained in:
Sergei Golubchik
2012-05-04 07:16:38 +02:00
52 changed files with 850 additions and 135 deletions

View File

@@ -12178,9 +12178,10 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
@param cond condition whose multiple equalities are to be checked
@param table constant table that has been read
@param const_key mark key parts as constant
*/
static void update_const_equal_items(COND *cond, JOIN_TAB *tab)
static void update_const_equal_items(COND *cond, JOIN_TAB *tab, bool const_key)
{
if (!(cond->used_tables() & tab->table->map))
return;
@@ -12191,7 +12192,10 @@ static void update_const_equal_items(COND *cond, JOIN_TAB *tab)
List_iterator_fast<Item> li(*cond_list);
Item *item;
while ((item= li++))
update_const_equal_items(item, tab);
update_const_equal_items(item, tab,
(((Item_cond*) cond)->top_level() &&
((Item_cond*) cond)->functype() ==
Item_func::COND_AND_FUNC));
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
@@ -12221,7 +12225,8 @@ static void update_const_equal_items(COND *cond, JOIN_TAB *tab)
TABLE *tab= field->table;
KEYUSE *use;
for (use= stat->keyuse; use && use->table == tab; use++)
if (!use->is_for_hash_join() && possible_keys.is_set(use->key) &&
if (const_key &&
!use->is_for_hash_join() && possible_keys.is_set(use->key) &&
tab->key_info[use->key].key_part[use->keypart].field ==
field)
tab->const_key_parts[use->key]|= use->keypart_map;
@@ -16428,7 +16433,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
List_iterator<TABLE_LIST> ti(join->select_lex->leaf_tables);
/* Check appearance of new constant items in Item_equal objects */
if (join->conds)
update_const_equal_items(join->conds, tab);
update_const_equal_items(join->conds, tab, TRUE);
while ((tbl= ti++))
{
TABLE_LIST *embedded;
@@ -16437,7 +16442,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
{
embedded= embedding;
if (embedded->on_expr)
update_const_equal_items(embedded->on_expr, tab);
update_const_equal_items(embedded->on_expr, tab, TRUE);
embedding= embedded->embedding;
}
while (embedding &&
@@ -18265,7 +18270,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
int ref_key;
uint UNINIT_VAR(ref_key_parts);
int order_direction= 0;
uint used_key_parts;
uint used_key_parts= 0;
TABLE *table=tab->table;
SQL_SELECT *select=tab->select;
key_map usable_keys;