List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:December 21 2005 7:17am
Subject:bk commit into 5.1 tree (sergefp:1.1972)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of psergey. When psergey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1972 05/12/21 10:16:57 sergefp@stripped +2 -0
  WL#2985 "Partition pruning" post-merge fixes:
  No matter if partitioning is compiled in or not, don't try to evaluate the condition on
  constant tables if there is a constant table that 1)is not inner wrt some outer join,
  and 2) either range analysis or partition pruning on this table has inferred that there will
  be no record matches.

  sql/sql_select.cc
    1.377 05/12/21 10:15:07 sergefp@stripped +9 -15
    WL#2985 "Partition pruning" post-merge fixes:
    No matter if partitioning is compiled in or not, don't try to evaluate the condition on
    constant tables if there is a constant table that 1)is not inner wrt some outer join,
    and 2) either range analysis or partition pruning on this table has inferred that there will
    be no record matches.

  mysql-test/r/ndb_charset.result
    1.10 05/12/21 10:15:07 sergefp@stripped +2 -2
    Adjusted test results (the new ones are right, as records_in_range() returns 0 for the condition)

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	sergefp
# Host:	newbox.mylan
# Root:	/home/psergey/mysql-5.1-ppruning-merge

--- 1.376/sql/sql_select.cc	2005-12-20 23:03:59 +03:00
+++ 1.377/sql/sql_select.cc	2005-12-21 10:15:07 +03:00
@@ -1936,7 +1936,7 @@
   if (select)
   {
     select->head=table;
-    table->reginfo.impossible_range=0;
+    DBUG_ASSERT(!table->reginfo.impossible_range);
     if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0,
                                           limit, 0)) == 1)
       DBUG_RETURN(select->quick->records);
@@ -2245,9 +2245,9 @@
 
     if (!s->table->pos_in_table_list->embedding)
     {
+      s->table->reginfo.impossible_range= FALSE;
 #ifdef WITH_PARTITION_STORAGE_ENGINE
       Item *pprune_cond= *s->on_expr_ref ? *s->on_expr_ref : conds;
-      s->table->reginfo.impossible_range= FALSE;
       if (prune_partitions(join->thd, s->table, pprune_cond, 
                            found_const_table_map))
       {
@@ -5282,24 +5282,18 @@
             cond_tab->select_cond->quick_fix_field();
           }       
         }
-        /* 
-          We're going to evaluate the table condition with 'default' field 
-          values. In partitioning, it could be that the condition is
-          satisified with default values, but still we've inferred that no
-          records will match. To handle this case, check impossible_range
-          first.
+        /*
+          Before evaluating the const_cond, check if it has been identified
+          as false by range/partition pruning analysis.
         */
-        bool partitioning_pruned_away= FALSE;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
+        bool const_cond_is_false= FALSE;
         for (JOIN_TAB *ctab= join->join_tab; 
              ctab < join->join_tab + join->const_tables; ctab++)
         {
-          if (ctab->table->reginfo.impossible_range)
-            partitioning_pruned_away= TRUE;
+          if (!(*ctab->on_expr_ref) && ctab->table->reginfo.impossible_range)
+            const_cond_is_false= TRUE;
         }
-#endif
-        if (partitioning_pruned_away ||
-            const_cond && !const_cond->val_int())
+        if (const_cond_is_false || (const_cond && !const_cond->val_int()))
         {
 	  DBUG_PRINT("info",("Found impossible WHERE condition"));
 	  DBUG_RETURN(1);	 // Impossible const condition

--- 1.9/mysql-test/r/ndb_charset.result	2005-11-20 13:14:25 +03:00
+++ 1.10/mysql-test/r/ndb_charset.result	2005-12-21 10:15:07 +03:00
@@ -188,7 +188,7 @@
 6	AAA
 explain select * from t1 where a = 'zZz' order by p;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	const	a	NULL	NULL	NULL	1	
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 select * from t1 where a = 'aAa' order by p;
 p	a
 1	aAa
@@ -225,7 +225,7 @@
 6	AAA
 explain select * from t1 where a = 'zZz' order by p;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	const	a	NULL	NULL	NULL	1	
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 select * from t1 where a = 'aAa' order by p;
 p	a
 1	aAa
Thread
bk commit into 5.1 tree (sergefp:1.1972)Sergey Petrunia21 Dec