List:Commits« Previous MessageNext Message »
From:Roy Lyseng Date:September 21 2010 11:41am
Subject:bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)
View as plain text  
#At file:///home/rl136806/mysql/repo/mysql-review/ based on revid:roy.lyseng@stripped

 3245 Roy Lyseng	2010-09-21
      Refactoring: Make members positions and best_positions of class JOIN
      dynamically allocated instead of fixed-size arrays.
      This saves approx. 20 kbyte memory during optimization and execution
      for normal-sized join operations.
      
      sql/sql_select.cc
        Allocate positions and best_positions dynamically.
      
      sql/sql_select.h
        positions and best_positions (members of class JOIN) defined as
        pointers instead of arrays.

    modified:
      sql/sql_select.cc
      sql/sql_select.h
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-09-20 14:06:02 +0000
+++ b/sql/sql_select.cc	2010-09-21 11:36:51 +0000
@@ -4490,6 +4490,14 @@ make_join_statistics(JOIN *join, TABLE_L
   if (!stat || !stat_ref || !table_vector)
     DBUG_RETURN(1);				// Eom /* purecov: inspected */
 
+  if (!(join->positions=
+       (POSITION *)join->thd->alloc(sizeof(POSITION)*(table_count+1))))
+    DBUG_RETURN(TRUE);
+
+  if (!(join->best_positions=
+       (POSITION *)join->thd->alloc(sizeof(POSITION)*(table_count+1))))
+    DBUG_RETURN(TRUE);
+
   join->best_ref=stat_vector;
 
   stat_end=stat+table_count;

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2010-09-06 17:56:05 +0000
+++ b/sql/sql_select.h	2010-09-21 11:36:51 +0000
@@ -1613,7 +1613,7 @@ public:
   */
   ha_rows  fetch_limit;
   /* Finally picked QEP. This is result of join optimization */
-  POSITION best_positions[MAX_TABLES+1];
+  POSITION *best_positions;
 
 /******* Join optimization state members start *******/
   /*
@@ -1623,7 +1623,7 @@ public:
   TABLE_LIST *emb_sjm_nest;
   
   /* Current join optimization state */
-  POSITION positions[MAX_TABLES+1];
+  POSITION *positions;
   
   /*
     Bitmap of nested joins embedding the position at the end of the current 


Attachment: [text/bzr-bundle] bzr/roy.lyseng@oracle.com-20100921113651-qcy9t45dhiz76cek.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245) Roy Lyseng21 Sep
  • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Guilhem Bichot21 Sep
    • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Roy Lyseng22 Sep
  • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Tor Didriksen21 Sep
    • Re: bzr commit into mysql-next-mr-bugfixing branch (roy.lyseng:3245)Roy Lyseng22 Sep