← Back to team overview

maria-developers team mailing list archive

Rev 2732: MWL#17: Table elimination in file:///home/psergey/dev/maria-5.1-table-elim-r5/

 

At file:///home/psergey/dev/maria-5.1-table-elim-r5/

------------------------------------------------------------
revno: 2732
revision-id: psergey@xxxxxxxxxxxx-20090813093613-hy7tdlsgdy83xszq
parent: psergey@xxxxxxxxxxxx-20090813092402-jlqucf6nultxlv4b
committer: Sergey Petrunya <psergey@xxxxxxxxxxxx>
branch nick: maria-5.1-table-elim-r5
timestamp: Thu 2009-08-13 13:36:13 +0400
message:
  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.
=== modified file 'sql/opt_table_elimination.cc'
--- a/sql/opt_table_elimination.cc	2009-08-13 00:01:43 +0000
+++ b/sql/opt_table_elimination.cc	2009-08-13 09:36:13 +0000
@@ -676,16 +676,12 @@
     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;
         }
       }