3248 Roy Lyseng 2010-09-22
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. Made a derived class of Sql_alloc, so
operator new can be used instead of alloc().
modified:
sql/sql_select.cc
sql/sql_select.h
3247 Tor Didriksen 2010-09-22 [merge]
Auto-merge: next-mr-bugfixing => next-mr-opt-backporting
added:
mysql-test/include/rpl_assert.inc
mysql-test/suite/perfschema/r/checksum.result
mysql-test/suite/perfschema/t/checksum.test
modified:
dbug/dbug.c
include/mysql/service_my_snprintf.h
libservices/HOWTO
mysql-test/extra/rpl_tests/delayed_slave_wait_on_query.inc
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
mysql-test/include/wait_for_slave_param.inc
mysql-test/r/create.result
mysql-test/r/ctype_collate.result
mysql-test/r/explain.result
mysql-test/r/group_by.result
mysql-test/r/group_min_max.result
mysql-test/r/index_merge_myisam.result
mysql-test/r/innodb_mrr_none.result
mysql-test/r/join_cache_jcl1.result
mysql-test/r/join_nested.result
mysql-test/r/join_optimizer.result
mysql-test/r/merge.result
mysql-test/r/mix2_myisam.result
mysql-test/r/myisam.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
mysql-test/r/null.result
mysql-test/r/optimizer_switch_eng_cond_pushdown1.result
mysql-test/r/optimizer_switch_eng_cond_pushdown2.result
mysql-test/r/ps_1general.result
mysql-test/r/subselect_innodb.result
mysql-test/r/variables.result
mysql-test/suite/innodb/r/innodb.result
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/perfschema/r/server_init.result
mysql-test/suite/perfschema/t/server_init.test
mysql-test/suite/rpl/r/rpl_delayed_slave.result
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
mysql-test/suite/rpl/t/rpl_delayed_slave.test
mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt
mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt
mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt
mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result
mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
mysql-test/suite/sys_vars/r/optimizer_join_cache_level_basic.result
mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic.test
mysql-test/t/variables.test
mysql-test/valgrind.supp
packaging/WiX/mysql_server.wxs.in
sql/binlog.cc
sql/binlog.h
sql/mysqld.cc
sql/rpl_master.cc
sql/rpl_rli.cc
sql/rpl_slave.cc
sql/share/errmsg-utf8.txt
sql/sql_binlog.cc
sql/sql_plugin.cc
sql/sql_priv.h
sql/sys_vars.cc
storage/perfschema/pfs_engine_table.cc
storage/perfschema/table_events_waits.cc
storage/perfschema/table_events_waits.h
strings/my_vsnprintf.c
unittest/mysys/my_vsnprintf-t.c
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2010-09-22 06:51:45 +0000
+++ b/sql/sql_select.cc 2010-09-22 11:37:38 +0000
@@ -4491,6 +4491,14 @@ make_join_statistics(JOIN *join, TABLE_L
if (!stat || !stat_ref || !table_vector)
DBUG_RETURN(1); // Eom /* purecov: inspected */
+ if (!(join->positions=
+ new (join->thd->mem_root) POSITION[table_count+1]))
+ DBUG_RETURN(TRUE);
+
+ if (!(join->best_positions=
+ new (join->thd->mem_root) 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-22 11:37:38 +0000
@@ -1369,7 +1369,7 @@ enum_nested_loop_state sub_select_sjm(JO
advance_sj_state() for details.
*/
-typedef struct st_position
+typedef struct st_position : public Sql_alloc
{
/*
The "fanout" - number of output rows that will be produced (after
@@ -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-20100922113738-lzbny6n2lwtup3tj.bundle
| Thread |
|---|
| • bzr push into mysql-next-mr-bugfixing branch (roy.lyseng:3247 to 3248) | Roy Lyseng | 22 Sep |