MySQL 8.0.39
Source Code Documentation
|
#include <array>
#include <string>
#include "map_helpers.h"
#include "sql/join_optimizer/access_path.h"
#include "sql/join_optimizer/hypergraph.h"
#include "sql/join_optimizer/secondary_engine_costing_flags.h"
#include "sql/mem_root_array.h"
#include "sql/sql_const.h"
Go to the source code of this file.
Classes | |
struct | SargablePredicate |
A sargable (from “Search ARGument”) predicate is one that we can attempt to push down into an index (what we'd call “ref access” or “index range scan”/“quick”). More... | |
struct | JoinHypergraph |
A struct containing a join hypergraph of a single query block, encapsulating the constraints given by the relational expressions (e.g. More... | |
struct | JoinHypergraph::Node |
Functions | |
bool | MakeJoinHypergraph (THD *thd, std::string *trace, JoinHypergraph *graph, bool *where_is_always_false) |
Make a join hypergraph from the query block given by “graph->query_block”, converting from MySQL's join list structures to the ones expected by the hypergraph join optimizer. More... | |
void | MakeJoinGraphFromRelationalExpression (THD *thd, RelationalExpression *expr, std::string *trace, JoinHypergraph *graph) |
hypergraph::NodeMap | GetNodeMapFromTableMap (table_map table_map, const std::array< int, MAX_TABLES > &table_num_to_node_num) |
std::string | PrintDottyHypergraph (const JoinHypergraph &graph) |
For the given hypergraph, make a textual representation in the form of a dotty graph. More... | |
size_t | EstimateHashJoinKeyWidth (const RelationalExpression *expr) |
Estimates the size of the hash join keys generated from the equi-join predicates in "expr". More... | |
table_map | GetVisibleTables (const RelationalExpression *expr) |
size_t EstimateHashJoinKeyWidth | ( | const RelationalExpression * | expr | ) |
Estimates the size of the hash join keys generated from the equi-join predicates in "expr".
hypergraph::NodeMap GetNodeMapFromTableMap | ( | table_map | table_map, |
const std::array< int, MAX_TABLES > & | table_num_to_node_num | ||
) |
table_map GetVisibleTables | ( | const RelationalExpression * | expr | ) |
void MakeJoinGraphFromRelationalExpression | ( | THD * | thd, |
RelationalExpression * | expr, | ||
std::string * | trace, | ||
JoinHypergraph * | graph | ||
) |
bool MakeJoinHypergraph | ( | THD * | thd, |
std::string * | trace, | ||
JoinHypergraph * | graph, | ||
bool * | where_is_always_false | ||
) |
Make a join hypergraph from the query block given by “graph->query_block”, converting from MySQL's join list structures to the ones expected by the hypergraph join optimizer.
This includes pushdown of WHERE predicates, and detection of conditions suitable for hash join. However, it does not include simplification of outer to inner joins; that is presumed to have happened earlier.
The result is suitable for running DPhyp (subgraph_enumeration.h) to find optimal join planning.
std::string PrintDottyHypergraph | ( | const JoinHypergraph & | graph | ) |
For the given hypergraph, make a textual representation in the form of a dotty graph.
You can save this to a file and then use Graphviz to render this it a graphical representation of the hypergraph for easier debugging, e.g. like this:
dot -Tps graph.dot > graph.ps display graph.ps
See also Dbug_table_list_dumper.