← Back to team overview

maria-developers team mailing list archive

Rev 2731: 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: 2731
revision-id: psergey@xxxxxxxxxxxx-20090813092402-jlqucf6nultxlv4b
parent: psergey@xxxxxxxxxxxx-20090813000143-dukzk352hjywidk7
committer: Sergey Petrunya <psergey@xxxxxxxxxxxx>
branch nick: maria-5.1-table-elim-r5
timestamp: Thu 2009-08-13 13:24:02 +0400
message:
  MWL#17: Table elimination
  - Post-postreview changes fix: Do set NESTED_JOIN::n_tables to number of 
    tables left after elimination.
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-08-12 23:43:02 +0000
+++ b/sql/sql_select.cc	2009-08-13 09:24:02 +0000
@@ -114,7 +114,7 @@
                             COND *conds, bool top);
 static bool check_interleaving_with_nj(JOIN_TAB *next);
 static void restore_prev_nj_state(JOIN_TAB *last);
-static void reset_nj_counters(List<TABLE_LIST> *join_list);
+static void reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list);
 static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
                                           uint first_unused);
 
@@ -1011,7 +1011,7 @@
     DBUG_RETURN(1);
   }
   
-  reset_nj_counters(join_list);
+  reset_nj_counters(this, join_list);
   make_outerjoin_info(this);
 
   /*
@@ -4625,7 +4625,7 @@
   DBUG_ENTER("choose_plan");
 
   join->cur_embedding_map= 0;
-  reset_nj_counters(join->join_list);
+  reset_nj_counters(join, join->join_list);
   /*
     if (SELECT_STRAIGHT_JOIN option is set)
       reorder tables so dependent tables come after tables they depend 
@@ -8791,7 +8791,7 @@
                     tables which will be ignored.
 */
 
-static void reset_nj_counters(List<TABLE_LIST> *join_list)
+static void reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list)
 {
   List_iterator<TABLE_LIST> li(*join_list);
   TABLE_LIST *table;
@@ -8802,7 +8802,9 @@
     if ((nested_join= table->nested_join))
     {
       nested_join->counter= 0;
-      reset_nj_counters(&nested_join->join_list);
+      nested_join->n_tables= my_count_bits(nested_join->used_tables & 
+                                           ~join->eliminated_tables);
+      reset_nj_counters(join, &nested_join->join_list);
     }
   }
   DBUG_VOID_RETURN;