MySQL 8.0.29
Source Code Documentation
make_join_hypergraph.h File Reference
#include <array>
#include <string>
#include "map_helpers.h"
#include "sql/join_optimizer/access_path.h"
#include "sql/join_optimizer/hypergraph.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)
 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...
 

Function Documentation

◆ GetNodeMapFromTableMap()

hypergraph::NodeMap GetNodeMapFromTableMap ( table_map  table_map,
const std::array< int, MAX_TABLES > &  table_num_to_node_num 
)

◆ MakeJoinGraphFromRelationalExpression()

void MakeJoinGraphFromRelationalExpression ( THD thd,
RelationalExpression expr,
std::string *  trace,
JoinHypergraph graph 
)

◆ MakeJoinHypergraph()

bool MakeJoinHypergraph ( THD thd,
std::string *  trace,
JoinHypergraph graph 
)

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.

◆ PrintDottyHypergraph()

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.