summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2009-08-13 13:36:13 +0400
committerSergey Petrunya <psergey@askmonty.org>2009-08-13 13:36:13 +0400
commit536754c8c65e223207f2f631c7eda4ee4a6fc7d1 (patch)
treea305fa92b80ab4f52310fffe36f7938587b096fc /sql
parentb3f18c88664bfb774c84d5a427161f6bfffda1a8 (diff)
downloadmariadb-git-536754c8c65e223207f2f631c7eda4ee4a6fc7d1.tar.gz
MWL#17: Table elimination
Fixes after post-review fixes: - Don't search for tables in JOIN_TAB array. it's not initialized yet. use select_lex->leaf_tables instead.
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_table_elimination.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index deb4e8c860d..5f98288be96 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -676,16 +676,12 @@ Outer_join_dep *get_outer_join_dep(Table_elimination *te,
if (!(table_dep= te->table_deps[idx]))
{
TABLE *table= NULL;
- /*
- Locate and create the table. The search isnt very efficient but
- typically we won't get here as we process the ON expression first
- and that will create the Table_dep
- */
- for (uint i= 0; i < te->join->tables; i++)
+ for (TABLE_LIST *tlist= te->join->select_lex->leaf_tables; tlist;
+ tlist=tlist->next_leaf)
{
- if (te->join->join_tab[i].table->tablenr == (uint)idx)
+ if (tlist->table->tablenr == (uint)idx)
{
- table= te->join->join_tab[i].table;
+ table=tlist->table;
break;
}
}