From 41c766f30deb2bb2d46a7219e72257b614f243e4 Mon Sep 17 00:00:00 2001 From: Sergey Petrunya Date: Fri, 8 Jul 2011 19:09:30 +0400 Subject: [PATCH] Make table_elimination=on|off flag to be always present in @@optimizer_switch. --- sql/mysql_priv.h | 28 +++------------------------- sql/mysqld.cc | 13 ++----------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 249ee0e66a4..0d6cb60b842 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -591,37 +591,16 @@ protected: #define OPTIMIZER_SWITCH_JOIN_CACHE_HASHED (1ULL << 22) #define OPTIMIZER_SWITCH_JOIN_CACHE_BKA (1ULL << 23) #define OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE (1ULL << 24) -#ifdef DBUG_OFF -# define OPTIMIZER_SWITCH_LAST (1ULL << 25) -#else -# define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1ULL << 25) -# define OPTIMIZER_SWITCH_LAST (1ULL << 26) -#endif +#define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1ULL << 25) +#define OPTIMIZER_SWITCH_LAST (1ULL << 26) -#ifdef DBUG_OFF /* The following must be kept in sync with optimizer_switch_str in mysqld.cc */ /* TODO: Materialization is off by default to mimic 5.1/5.2 behavior. Once cost based choice between materialization and in-to-exists should be enabled by default, add OPTIMIZER_SWITCH_MATERIALIZATION */ -# define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \ - OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \ - OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \ - OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \ - OPTIMIZER_SWITCH_DERIVED_MERGE | \ - OPTIMIZER_SWITCH_DERIVED_WITH_KEYS | \ - OPTIMIZER_SWITCH_IN_TO_EXISTS | \ - OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE|\ - OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN|\ - OPTIMIZER_SWITCH_SUBQUERY_CACHE|\ - OPTIMIZER_SWITCH_SUBQUERY_CACHE | \ - OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL | \ - OPTIMIZER_SWITCH_JOIN_CACHE_HASHED | \ - OPTIMIZER_SWITCH_JOIN_CACHE_BKA | \ - OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE) -#else -# define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \ +#define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \ OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \ OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \ OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \ @@ -636,7 +615,6 @@ enabled by default, add OPTIMIZER_SWITCH_MATERIALIZATION OPTIMIZER_SWITCH_JOIN_CACHE_HASHED | \ OPTIMIZER_SWITCH_JOIN_CACHE_BKA | \ OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE) -#endif /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7ce39b2dea9..b297a611633 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -350,9 +350,7 @@ static const char *optimizer_switch_names[]= "join_cache_hashed", "join_cache_bka", "optimize_join_buffer_size", -#ifndef DBUG_OFF "table_elimination", -#endif "default", NullS }; @@ -384,9 +382,7 @@ static const unsigned int optimizer_switch_names_len[]= sizeof("join_cache_hashed") - 1, sizeof("join_cache_bka") - 1, sizeof("optimize_join_buffer_size") - 1, -#ifndef DBUG_OFF sizeof("table_elimination") - 1, -#endif sizeof("default") - 1 }; TYPELIB optimizer_switch_typelib= { array_elements(optimizer_switch_names)-1,"", @@ -502,12 +498,9 @@ static const char *optimizer_switch_str="index_merge=on,index_merge_union=on," "join_cache_incremental=on," "join_cache_hashed=on," "join_cache_bka=on," - "optimize_join_buffer_size=on" -#ifndef DBUG_OFF - ",table_elimination=on"; -#else + "optimize_join_buffer_size=on," + "table_elimination=on"; ; -#endif #ifdef SAFEMALLOC my_bool sf_malloc_trough_check= 0; #endif @@ -7559,9 +7552,7 @@ each time the SQL thread starts.", "subquery_cache, outer_join_with_cache, semijoin_with_cache, " "join_cache_incremental, join_cache_hashed, join_cache_bka, " "optimize_join_buffer_size" -#ifndef DBUG_OFF ", table_elimination" -#endif "} and val={on, off, default}.", &optimizer_switch_str, &optimizer_switch_str, 0, GET_STR, REQUIRED_ARG, /*OPTIMIZER_SWITCH_DEFAULT*/0, 0, 0, 0, 0, 0},