diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-02-16 00:59:02 +0300 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-02-16 00:59:02 +0300 |
commit | 089d2e2ea39c13de7e84c40c4c087775379b8442 (patch) | |
tree | 36255d9fcb978ebe83e3a1f4b4d482ec866cbf59 | |
parent | 7e5795fe04960e0916de6f9c349d62b7a6372e81 (diff) | |
download | mariadb-git-089d2e2ea39c13de7e84c40c4c087775379b8442.tar.gz |
Post-merge fixes part 2
-rw-r--r-- | sql/sql_join_cache.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 41 |
2 files changed, 30 insertions, 15 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 5f3aa7e16e8..58cbb3fd1ca 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -235,6 +235,10 @@ psergey-merge: was: } } start_tab= tab; + while (start_tab->bush_children && start_tab != join_tab) + start_tab++; + tab= start_tab; + //tables= join_tab-tab; //tables= 0; fields= 0; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ed893279777..db617cde353 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8402,13 +8402,21 @@ void check_join_cache_usage_for_tables(JOIN *join, ulonglong options, { //JOIN_TAB *first_sjm_table= NULL; //JOIN_TAB *last_sjm_table= NULL; + JOIN_TAB *tab; - for (uint i= join->const_tables; i < join->tables; i++) - join->join_tab[i].used_join_cache_level= join->max_allowed_join_cache_level; - - for (uint i= join->const_tables; i < join->tables; i++) + //for (uint i= join->const_tables; i < join->tables; i++) + for (tab= first_linear_tab(join, TRUE); + tab; + tab= next_linear_tab(join, tab, TRUE)) + { + tab->used_join_cache_level= join->max_allowed_join_cache_level; + } + + //for (uint i= join->const_tables; i < join->tables; i++) + for (tab= first_linear_tab(join, TRUE); + tab; + tab= next_linear_tab(join, tab, TRUE)) { - JOIN_TAB *tab= join->join_tab+i; #if 0 if (sj_is_materialize_strategy(join->best_positions[i].sj_strategy)) { @@ -8442,8 +8450,11 @@ void check_join_cache_usage_for_tables(JOIN *join, ulonglong options, // tab-1); prev_tab); tab->use_join_cache= test(tab->used_join_cache_level); + DBUG_ASSERT(!join->return_tab); + /* if (join->return_tab) i= join->return_tab-join->join_tab-1; // always >= 0 + */ break; default: tab->used_join_cache_level= 0; @@ -8507,8 +8518,11 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after) - it does not differentiate between inner joins, outer joins and semi-joins. Later it should be improved. */ + JOIN_TAB *prev_tab= tab - 1; + if ((tab->bush_root_tab && tab->bush_root_tab->bush_children->start == tab)) + prev_tab= NULL; tab->partial_join_cardinality= join->best_positions[i].records_read * - (i ? (tab-1)->partial_join_cardinality : 1); + (prev_tab? prev_tab->partial_join_cardinality : 1); } check_join_cache_usage_for_tables(join, options, no_jbuf_after); @@ -8519,23 +8533,20 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after) tab= next_linear_tab(join, tab, TRUE), i++) { //JOIN_TAB *tab=join->join_tab+i; + if (tab->bush_children) + { + if (setup_sj_materialization(tab)) + return TRUE; + } + TABLE *table=tab->table; uint jcl= tab->used_join_cache_level; tab->read_record.table= table; tab->read_record.file=table->file; tab->read_record.unlock_row= rr_unlock_row; - tab->next_select=sub_select; /* normal select */ tab->sorted= sorted; sorted= 0; // only first must be sorted - if (tab->bush_children) - { - if (setup_sj_materialization(tab)) - return TRUE; - table= tab->table; - } - - if (!(tab->bush_root_tab && tab->bush_root_tab->bush_children->end == tab + 1)) { |