1 #ifndef SQL_PLANNER_INCLUDED
2 #define SQL_PLANNER_INCLUDED
21 #include "sql_class.h"
24 #include "sql_optimizer.h"
48 : search_depth(determine_search_depth(thd->variables.optimizer_search_depth,
50 prune_level(thd->variables.optimizer_prune_level),
52 cur_embedding_map(0), emb_sjm_nest(sjm_nest),
53 excluded_tables((sjm_nest ?
68 const uint search_depth;
69 const uint prune_level;
77 nested_join_map cur_embedding_map;
91 const table_map excluded_tables;
93 void best_access_path(
JOIN_TAB *s, table_map remaining_tables, uint idx,
94 bool disable_jbuf,
double record_count,
96 bool check_interleaving_with_nj(
JOIN_TAB *next_tab);
97 void advance_sj_state(table_map remaining_tables,
99 double *current_rowcount,
double *current_cost,
101 void backout_nj_state(
const table_map remaining_tables,
103 void optimize_straight_join(table_map join_tables);
104 bool greedy_search(table_map remaining_tables);
105 bool best_extension_by_limited_search(table_map remaining_tables,
109 uint current_search_depth);
110 table_map eq_ref_extension_by_limited_search(
111 table_map remaining_tables,
115 uint current_search_depth);
116 void consider_plan(uint idx,
double record_count,
double read_time,
118 bool fix_semijoin_strategies();
119 bool semijoin_firstmatch_loosescan_access_paths(
120 uint first_tab, uint last_tab, table_map remaining_tables,
121 bool loosescan,
bool final,
122 double *newcount,
double *newcost);
123 void semijoin_mat_scan_access_paths(
124 uint last_inner_tab, uint last_outer_tab,
125 table_map remaining_tables,
TABLE_LIST *sjm_nest,
bool final,
126 double *newcount,
double *newcost);
127 void semijoin_mat_lookup_access_paths(
129 double *newcount,
double *newcost);
130 void semijoin_dupsweedout_access_paths(
131 uint first_tab, uint last_tab,
132 table_map remaining_tables,
133 double *newcount,
double *newcost);
135 static uint determine_search_depth(uint search_depth, uint table_count);
138 void get_partial_join_cost(
JOIN *join, uint n_tables,
double *read_time_arg,
139 double *record_count_arg);