diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-16 15:07:04 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-16 15:07:04 +0300 |
commit | 8543621fa0f4a3c4102ac8f799888ef79e2e1dcf (patch) | |
tree | 29e8f301ef929cfe1c00eec9dee265aa0acaa350 /sql/mysql_priv.h | |
parent | f458e198c0bea67c6a3787738108bbfb139639bd (diff) | |
parent | bcee6652c6052cabd67f8d30c14e162235749d38 (diff) | |
download | mariadb-git-8543621fa0f4a3c4102ac8f799888ef79e2e1dcf.tar.gz |
Merge with 5.3 main
Diffstat (limited to 'sql/mysql_priv.h')
-rw-r--r-- | sql/mysql_priv.h | 70 |
1 files changed, 46 insertions, 24 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 9c4b887091a..4adcc078eeb 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -570,26 +570,32 @@ protected: #define OPTIMIZER_SWITCH_FIRSTMATCH 64 #define OPTIMIZER_SWITCH_LOOSE_SCAN 128 #define OPTIMIZER_SWITCH_MATERIALIZATION 256 -#define OPTIMIZER_SWITCH_SEMIJOIN 512 -#define OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE 1024 -#define OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN (1<<11) -#define OPTIMIZER_SWITCH_SUBQUERY_CACHE (1<<12) -#define OPTIMIZER_SWITCH_MRR_SORT_KEYS (1<<13) -#define OPTIMIZER_SWITCH_OUTER_JOIN_WITH_CACHE (1<<14) -#define OPTIMIZER_SWITCH_SEMIJOIN_WITH_CACHE (1<<15) -#define OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL (1<<16) -#define OPTIMIZER_SWITCH_JOIN_CACHE_HASHED (1<<17) -#define OPTIMIZER_SWITCH_JOIN_CACHE_BKA (1<<18) -#define OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE (1<<19) +#define OPTIMIZER_SWITCH_IN_TO_EXISTS 512 +#define OPTIMIZER_SWITCH_SEMIJOIN 1024 +#define OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE (1<<11) +#define OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN (1<<12) +#define OPTIMIZER_SWITCH_SUBQUERY_CACHE (1<<13) +#define OPTIMIZER_SWITCH_MRR_SORT_KEYS (1<<14) +#define OPTIMIZER_SWITCH_OUTER_JOIN_WITH_CACHE (1<<15) +#define OPTIMIZER_SWITCH_SEMIJOIN_WITH_CACHE (1<<16) +#define OPTIMIZER_SWITCH_JOIN_CACHE_INCREMENTAL (1<<17) +#define OPTIMIZER_SWITCH_JOIN_CACHE_HASHED (1<<18) +#define OPTIMIZER_SWITCH_JOIN_CACHE_BKA (1<<19) +#define OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE (1<<20) #ifdef DBUG_OFF -# define OPTIMIZER_SWITCH_LAST (1<<20) -#else -# define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1<<20) # define OPTIMIZER_SWITCH_LAST (1<<21) +#else +# define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1<<21) +# define OPTIMIZER_SWITCH_LAST (1<<22) #endif #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 | \ @@ -597,7 +603,7 @@ protected: OPTIMIZER_SWITCH_INDEX_COND_PUSHDOWN | \ OPTIMIZER_SWITCH_FIRSTMATCH | \ OPTIMIZER_SWITCH_LOOSE_SCAN | \ - OPTIMIZER_SWITCH_MATERIALIZATION | \ + OPTIMIZER_SWITCH_IN_TO_EXISTS | \ OPTIMIZER_SWITCH_SEMIJOIN | \ OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE|\ OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN|\ @@ -617,7 +623,7 @@ protected: OPTIMIZER_SWITCH_TABLE_ELIMINATION | \ OPTIMIZER_SWITCH_FIRSTMATCH | \ OPTIMIZER_SWITCH_LOOSE_SCAN | \ - OPTIMIZER_SWITCH_MATERIALIZATION | \ + OPTIMIZER_SWITCH_IN_TO_EXISTS | \ OPTIMIZER_SWITCH_SEMIJOIN | \ OPTIMIZER_SWITCH_PARTIAL_MATCH_ROWID_MERGE|\ OPTIMIZER_SWITCH_PARTIAL_MATCH_TABLE_SCAN|\ @@ -672,15 +678,30 @@ protected: */ #define CONTEXT_ANALYSIS_ONLY_DERIVED 4 -// uncachable cause -#define UNCACHEABLE_DEPENDENT 1 -#define UNCACHEABLE_RAND 2 -#define UNCACHEABLE_SIDEEFFECT 4 -/// forcing to save JOIN for explain -#define UNCACHEABLE_EXPLAIN 8 +/* + Uncachable causes: + +This subquery has fields from outer query (put by user) +*/ +#define UNCACHEABLE_DEPENDENT_GENERATED 1 +/* This subquery contains functions with random result */ +#define UNCACHEABLE_RAND 2 +/* This subquery contains functions with side effect */ +#define UNCACHEABLE_SIDEEFFECT 4 +/* Forcing to save JOIN tables for explain */ +#define UNCACHEABLE_EXPLAIN 8 /* For uncorrelated SELECT in an UNION with some correlated SELECTs */ -#define UNCACHEABLE_UNITED 16 -#define UNCACHEABLE_CHECKOPTION 32 +#define UNCACHEABLE_UNITED 16 +#define UNCACHEABLE_CHECKOPTION 32 +/* + This subquery has fields from outer query injected during + transformation process +*/ +#define UNCACHEABLE_DEPENDENT_INJECTED 64 + +/* This subquery has fields from outer query (any nature) */ +#define UNCACHEABLE_DEPENDENT (UNCACHEABLE_DEPENDENT_GENERATED | \ + UNCACHEABLE_DEPENDENT_INJECTED) /* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */ #define UNDEF_POS (-1) @@ -1640,6 +1661,7 @@ inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array, } int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds); +void wrap_ident(THD *thd, Item **conds); int setup_ftfuncs(SELECT_LEX* select); int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); void wait_for_condition(THD *thd, pthread_mutex_t *mutex, |