List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:July 5 2008 8:38am
Subject:bzr push into mysql-6.0 branch (sergefp:2652)
View as plain text  
 2652 Sergey Petrunia	2008-06-16
      * Added comment
      * When considering "range checked for each record" access, refer to the 
        SQL_SELECT of this table and not that of the join's first non-const table.
modified:
  sql/sql_select.cc

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-05-31 07:14:57 +0000
+++ b/sql/sql_select.cc	2008-06-15 22:43:45 +0000
@@ -7549,7 +7549,15 @@ make_join_select(JOIN *join,SQL_SELECT *
 	  thd->lex->current_select->master_unit() ==
 	  &thd->lex->unit)		// not upper level SELECT
         join->const_table_map|=RAND_TABLE_BIT;
-      {						// Check const tables
+
+      /*
+        Extract expressions that depend on constant tables
+        1. Const part of the join's WHERE clause can be checked immediately
+           and if it is not satisfied then the join has empty result
+        2. Constant parts of outer joins' ON expressions must be attached 
+           there inside the triggers.
+      */
+      {
         COND *const_cond=
 	  make_cond_for_table(cond,
                               join->const_table_map,
@@ -7796,9 +7804,9 @@ make_join_select(JOIN *join,SQL_SELECT *
 	    tab->keys=sel->quick_keys;
             tab->keys.merge(sel->needed_reg);
 	    tab->use_quick= (!sel->needed_reg.is_clear_all() &&
-			     (select->quick_keys.is_clear_all() ||
-			      (select->quick &&
-			       (select->quick->records >= 100L)))) ?
+			     (sel->quick_keys.is_clear_all() ||
+			      (sel->quick &&
+			       (sel->quick->records >= 100L)))) ?
 	      2 : 1;
 	    sel->read_tables= used_tables & ~current_map;
 	  }

Thread
bzr push into mysql-6.0 branch (sergefp:2652) Sergey Petrunia5 Jul