mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MWL#89: Cost-based choice between Materialization and IN->EXISTS transformation
Phase 3: Implementation of re-optimization of subqueries with injected predicates and cost comparison between Materialization and IN->EXISTS strategies. The commit contains the following known problems: - The implementation of EXPLAIN has not been re-engineered to reflect the changes in subquery optimization. EXPLAIN for subqueries is called during the execute phase, which results in different code paths during JOIN::optimize and thus in differing EXPLAIN messages for constant/system tables. - There are some valgrind warnings that need investigation - Several EXPLAINs with minor differences need to be reconsidered after fixing the EXPLAIN problem above. This patch also adds one extra optimizer_switch: 'in_to_exists' for complete manual control of the subquery execution strategies.
This commit is contained in:
@ -1369,8 +1369,21 @@ inline bool sj_is_materialize_strategy(uint strategy)
|
||||
|
||||
class JOIN :public Sql_alloc
|
||||
{
|
||||
private:
|
||||
JOIN(const JOIN &rhs); /**< not implemented */
|
||||
JOIN& operator=(const JOIN &rhs); /**< not implemented */
|
||||
|
||||
protected:
|
||||
/* Support for plan reoptimization with rewritten conditions. */
|
||||
int reoptimize(Item *added_where, table_map join_tables,
|
||||
POSITION *save_best_positions);
|
||||
int save_query_plan(DYNAMIC_ARRAY *save_keyuse, POSITION *save_positions,
|
||||
KEYUSE **save_join_tab_keyuse,
|
||||
key_map *save_join_tab_checked_keys);
|
||||
void restore_query_plan(DYNAMIC_ARRAY *save_keyuse, POSITION *save_positions,
|
||||
KEYUSE **save_join_tab_keyuse,
|
||||
key_map *save_join_tab_checked_keys);
|
||||
|
||||
public:
|
||||
JOIN_TAB *join_tab,**best_ref;
|
||||
JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs
|
||||
@ -1746,7 +1759,7 @@ public:
|
||||
NULL : join_tab+const_tables;
|
||||
}
|
||||
bool setup_subquery_caches();
|
||||
bool choose_subquery_plan();
|
||||
bool choose_subquery_plan(table_map join_tables);
|
||||
private:
|
||||
/**
|
||||
TRUE if the query contains an aggregate function but has no GROUP
|
||||
|
Reference in New Issue
Block a user