[Commits] Rev 3514: MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields in file:///home/psergey/dev2/5.5-look7/

Sergey Petrunya psergey at askmonty.org
Wed Aug 29 10:07:00 EEST 2012


At file:///home/psergey/dev2/5.5-look7/

------------------------------------------------------------
revno: 3514
revision-id: psergey at askmonty.org-20120829070658-57lavspdu4kk9tx7
parent: psergey at askmonty.org-20120828120322-oc6tznxro84kgkdr
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-look7
timestamp: Wed 2012-08-29 11:06:58 +0400
message:
  MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
  - Call value->is_null() only when  !value->is_expensive().
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2012-08-28 11:20:37 +0000
+++ b/sql/sql_select.cc	2012-08-29 07:06:58 +0000
@@ -3881,8 +3881,10 @@ merge_key_fields(KEY_FIELD *start,KEY_FI
                                 new_fields->null_rejecting);
 	}
 	else if (old->eq_func && new_fields->eq_func &&
-		 ((old->val->const_item() && old->val->is_null()) || 
-                  new_fields->val->is_null()))
+		 ((old->val->const_item() && !old->val->is_expensive() 
+                   && old->val->is_null()) || 
+                  (!new_fields->val->is_expensive() && 
+                   new_fields->val->is_null())))
 	{
 	  /* field = expression OR field IS NULL */
 	  old->level= and_level;
@@ -3896,7 +3898,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FI
             Remember the NOT NULL value unless the value does not depend
             on other tables.
           */
-	  if (!old->val->used_tables() && old->val->is_null())
+	  if (!old->val->used_tables() && !old->val->is_expensive() && 
+              old->val->is_null())
 	    old->val= new_fields->val;
 	}
 	else



More information about the commits mailing list