List:Commits« Previous MessageNext Message »
From:kgeorge Date:September 13 2006 4:27pm
Subject:bk commit into 5.0 tree (gkodinov:1.2263)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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@stripped, 2006-09-13 19:27:10+03:00, gkodinov@rakia.(none) +1 -0
  Merge gkodinov@stripped:/home/bk/mysql-5.0-opt
  into  rakia.(none):/home/kgeorge/mysql/autopush/B21798-5.0-opt
  MERGE: 1.2260.2.1

  sql/sql_select.cc@stripped, 2006-09-13 19:27:06+03:00, gkodinov@rakia.(none) +0 -0
    Auto merged
    MERGE: 1.450.1.1

# 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:	gkodinov
# Host:	rakia.(none)
# Root:	/home/kgeorge/mysql/autopush/B21798-5.0-opt/RESYNC

--- 1.452/sql/sql_select.cc	2006-09-13 19:27:16 +03:00
+++ 1.453/sql/sql_select.cc	2006-09-13 19:27:16 +03:00
@@ -76,7 +76,9 @@ static store_key *get_store_key(THD *thd
 				KEYUSE *keyuse, table_map used_tables,
 				KEY_PART_INFO *key_part, char *key_buff,
 				uint maybe_null);
-static bool make_simple_join(JOIN *join,TABLE *tmp_table);
+static bool make_simple_join(JOIN *join,TABLE *tmp_table,
+                 TABLE ***simplejoin_tableptr_cache,
+                 JOIN_TAB **simplejoin_tab_cache);
 static void make_outerjoin_info(JOIN *join);
 static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
 static void make_join_readinfo(JOIN *join,uint options);
@@ -1273,7 +1275,10 @@ JOIN::reinit()
     memcpy(join_tab, join_tab_save, sizeof(JOIN_TAB) * tables);
 
   if (tmp_join)
+  {
+    memcpy(&subq_cache, &tmp_join->subq_cache, sizeof (subq_cache));
     restore_tmp();
+  }
 
   /* Reset of sum functions */
   if (sum_funcs)
@@ -1435,6 +1440,7 @@ JOIN::exec()
         (curr_join may have been modified during last exection and we need
         to reset it)
       */
+      tmp_join->subq_cache= curr_join->subq_cache;
       curr_join= tmp_join;
     }
     curr_tmp_table= exec_tmp_table1;
@@ -1523,7 +1529,9 @@ JOIN::exec()
       
       /* Free first data from old join */
       curr_join->join_free();
-      if (make_simple_join(curr_join, curr_tmp_table))
+      if (make_simple_join(curr_join, curr_tmp_table,
+                           &curr_join->subq_cache.simplejoin_table_ptr_cache1,
+                           &curr_join->subq_cache.simplejoin_tab_cache1))
 	DBUG_VOID_RETURN;
       calc_group_buffer(curr_join, group_list);
       count_field_types(&curr_join->tmp_table_param,
@@ -1642,7 +1650,9 @@ JOIN::exec()
       curr_join->select_distinct=0;
     }
     curr_tmp_table->reginfo.lock_type= TL_UNLOCK;
-    if (make_simple_join(curr_join, curr_tmp_table))
+    if (make_simple_join(curr_join, curr_tmp_table,
+                         &curr_join->subq_cache.simplejoin_table_ptr_cache2,
+                         &curr_join->subq_cache.simplejoin_tab_cache2))
       DBUG_VOID_RETURN;
     calc_group_buffer(curr_join, curr_join->group_list);
     count_field_types(&curr_join->tmp_table_param, *curr_all_fields, 0);
@@ -4943,15 +4953,25 @@ store_val_in_field(Field *field, Item *i
 
 
 static bool
-make_simple_join(JOIN *join,TABLE *tmp_table)
+make_simple_join(JOIN *join,TABLE *tmp_table,
+                 TABLE ***simplejoin_tableptr_cache,
+                 JOIN_TAB **simplejoin_tab_cache)
 {
   TABLE **tableptr;
   JOIN_TAB *join_tab;
   DBUG_ENTER("make_simple_join");
 
-  if (!(tableptr=(TABLE**) join->thd->alloc(sizeof(TABLE*))) ||
-      !(join_tab=(JOIN_TAB*) join->thd->alloc(sizeof(JOIN_TAB))))
+  if (*simplejoin_tableptr_cache)
+    tableptr= *simplejoin_tableptr_cache;
+  else if (!(*simplejoin_tableptr_cache= 
+             tableptr=(TABLE**) join->thd->alloc(sizeof(TABLE*))))
     DBUG_RETURN(TRUE);
+  if (*simplejoin_tab_cache)
+    join_tab= *simplejoin_tab_cache;
+  else if (!(*simplejoin_tab_cache= 
+             join_tab=(JOIN_TAB*) join->thd->alloc(sizeof(JOIN_TAB))))
+    DBUG_RETURN(TRUE);
+
   join->join_tab=join_tab;
   join->table=tableptr; tableptr[0]=tmp_table;
   join->tables=1;
@@ -11987,8 +12007,12 @@ create_sort_index(THD *thd, JOIN *join, 
 
   if (test_if_skip_sort_order(tab,order,select_limit,0))
     DBUG_RETURN(0);
-  if (!(sortorder=make_unireg_sortorder(order,&length)))
+  if (!(join->subq_cache.sortorder_cache= 
+        sortorder= make_unireg_sortorder(order,&length,
+                                         join->subq_cache.sortorder_cache,
+                                         join->subq_cache.sortorder_cache_len)))
     goto err;				/* purecov: inspected */
+  join->subq_cache.sortorder_cache_len= length;
   /* It's not fatal if the following alloc fails */
   table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
                                              MYF(MY_WME | MY_ZEROFILL));
@@ -12381,7 +12405,8 @@ err:
 }
 
 
-SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length)
+SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
+                                  SORT_FIELD *cache, uint cached_len)
 {
   uint count;
   SORT_FIELD *sort,*pos;
@@ -12390,7 +12415,9 @@ SORT_FIELD *make_unireg_sortorder(ORDER 
   count=0;
   for (ORDER *tmp = order; tmp; tmp=tmp->next)
     count++;
-  pos=sort=(SORT_FIELD*) sql_alloc(sizeof(SORT_FIELD)*(count+1));
+  if (!cache || cached_len != count)
+    cache= (SORT_FIELD*) sql_alloc(sizeof(SORT_FIELD)*(count+1));
+  pos= sort= cache;
   if (!pos)
     return 0;
 
Thread
bk commit into 5.0 tree (gkodinov:1.2263)kgeorge13 Sep