This class determines the optimal join order for tables within a basic query block, ie a query specification clause, possibly extended with semi-joined tables from embedded subqueries.
More...
|
Key_use * | find_best_ref (const JOIN_TAB *tab, const table_map remaining_tables, const uint idx, const double prefix_rowcount, bool *found_condition, table_map *ref_depends_map, uint *used_key_parts) |
| Find the best index to do 'ref' access on for a table. More...
|
|
double | calculate_scan_cost (const JOIN_TAB *tab, const uint idx, const Key_use *best_ref, const double prefix_rowcount, const bool found_condition, const bool disable_jbuf, double *rows_after_filtering, Opt_trace_object *trace_access_scan) |
| Calculate the cost of range/table/index scanning table 'tab'. More...
|
|
void | best_access_path (JOIN_TAB *tab, const table_map remaining_tables, const uint idx, bool disable_jbuf, const double prefix_rowcount, POSITION *pos) |
| Find the best access path for an extension of a partial execution plan and add this path to the plan. More...
|
|
bool | semijoin_loosescan_fill_driving_table_position (const JOIN_TAB *s, table_map remaining_tables, uint idx, double prefix_rowcount, POSITION *loose_scan_pos) |
| Fills a POSITION object of the driving table of a semi-join LooseScan range, with the cheapest access path. More...
|
|
bool | check_interleaving_with_nj (JOIN_TAB *next_tab) |
| Check interleaving with an inner tables of an outer join for extension table. More...
|
|
void | advance_sj_state (table_map remaining_tables, const JOIN_TAB *tab, uint idx) |
| Do semi-join optimization step after we've added a new tab to join prefix. More...
|
|
void | backout_nj_state (const table_map remaining_tables, const JOIN_TAB *tab) |
| Nested joins perspective: Remove the last table from the join order. More...
|
|
void | optimize_straight_join (table_map join_tables) |
| Select the best ways to access the tables in a query without reordering them. More...
|
|
bool | greedy_search (table_map remaining_tables) |
| Find a good, possibly optimal, query execution plan (QEP) by a greedy search. More...
|
|
bool | best_extension_by_limited_search (table_map remaining_tables, uint idx, uint current_search_depth) |
| Find a good, possibly optimal, query execution plan (QEP) by a possibly exhaustive search. More...
|
|
table_map | eq_ref_extension_by_limited_search (table_map remaining_tables, uint idx, uint current_search_depth) |
| Heuristic utility used by best_extension_by_limited_search(). More...
|
|
bool | consider_plan (uint idx, Opt_trace_object *trace_obj) |
| Cost calculation of another (partial-)QEP has been completed. More...
|
|
bool | fix_semijoin_strategies () |
| Fix semi-join strategies for the picked join order. More...
|
|
bool | semijoin_firstmatch_loosescan_access_paths (uint first_tab, uint last_tab, table_map remaining_tables, bool loosescan, double *newcount, double *newcost) |
| Find best access paths for semi-join FirstMatch or LooseScan strategy and calculate rowcount and cost based on these. More...
|
|
void | semijoin_mat_scan_access_paths (uint last_inner_tab, uint last_outer_tab, table_map remaining_tables, Table_ref *sjm_nest, double *newcount, double *newcost) |
| Find best access paths for semi-join MaterializeScan strategy and calculate rowcount and cost based on these. More...
|
|
void | semijoin_mat_lookup_access_paths (uint last_inner, Table_ref *sjm_nest, double *newcount, double *newcost) |
| Find best access paths for semi-join MaterializeLookup strategy. More...
|
|
void | semijoin_dupsweedout_access_paths (uint first_tab, uint last_tab, double *newcount, double *newcost) |
| Find best access paths for semi-join DuplicateWeedout strategy and calculate rowcount and cost based on these. More...
|
|
double | lateral_derived_cost (const JOIN_TAB *tab, const uint idx, const double prefix_rowcount, const Cost_model_server *cost_model) |
| If table is a lateral derived table, calculates the "cost of
materialization", which is the cost of a single materialization (available in the DT's underlying JOIN final plan) multiplied by the number of rows output by the last-in-plan table which DT references (available in a POSITION structure). More...
|
|
table_map | calculate_lateral_deps_of_final_plan (uint tab_no) const |
| Calculate the lateral dependencies of the suffix of JOIN_TABs from tab_no to join->tables-1 in the final join plan, i.e. More...
|
|
bool | plan_has_duplicate_tabs () const |
| Check if any Table_ref appears twice in the plan (which is an error). More...
|
|
This class determines the optimal join order for tables within a basic query block, ie a query specification clause, possibly extended with semi-joined tables from embedded subqueries.
This class takes as prerequisite a join class where all dependencies among tables have been sorted out, all possible access paths have been sorted out, and all statistics information has been filled in.
The class has a sole public function that will calculate the most optimal plan based on the inputs and the environment, such as prune level and greedy optimizer search depth. For more information, see the function headers for the private functions greedy_search(), best_extension_by_limited_search() and eq_ref_extension_by_limited_search().