MySQL 8.0.29
Source Code Documentation
explain_access_path.cc File Reference

Classes

struct  ExplainData
 
struct  ExplainData::Child
 

Functions

static string PrintRanges (const QUICK_RANGE *const *ranges, unsigned num_ranges, const KEY_PART_INFO *key_part, bool single_part_only)
 
static string JoinTypeToString (JoinType join_type)
 
static string HashJoinTypeToString (RelationalExpression::Type join_type)
 
static void GetAccessPathsFromItem (Item *item_arg, const char *source_text, vector< ExplainData::Child > *children)
 
vector< ExplainData::ChildGetAccessPathsFromSelectList (JOIN *join)
 
ExplainData ExplainAccessPath (const AccessPath *path, JOIN *join, bool include_costs)
 
static void AddTableIteratorDescription (const AccessPath *path, JOIN *join, vector< string > *description)
 
static void ExplainMaterializeAccessPath (const AccessPath *path, JOIN *join, vector< string > *description, vector< ExplainData::Child > *children)
 
static void ExplainIndexSkipScanAccessPath (const AccessPath *path, JOIN *join, vector< string > *description, vector< ExplainData::Child > *children)
 
static void ExplainGroupIndexSkipScanAccessPath (const AccessPath *path, JOIN *join, vector< string > *description, vector< ExplainData::Child > *children)
 
static void AddChildrenFromPushedCondition (const TABLE *table, vector< ExplainData::Child > *children)
 
string PrintQueryPlan (int level, AccessPath *path, JOIN *join, bool is_root_of_join, vector< string > *tokens_for_force_subplan)
 
string GetForceSubplanToken (AccessPath *path, JOIN *join)
 Generate a digest based on the subplan that the given access path represents. More...
 

Function Documentation

◆ AddChildrenFromPushedCondition()

static void AddChildrenFromPushedCondition ( const TABLE table,
vector< ExplainData::Child > *  children 
)
static

◆ AddTableIteratorDescription()

static void AddTableIteratorDescription ( const AccessPath path,
JOIN join,
vector< string > *  description 
)
static

◆ ExplainAccessPath()

ExplainData ExplainAccessPath ( const AccessPath path,
JOIN join,
bool  include_costs 
)

◆ ExplainGroupIndexSkipScanAccessPath()

static void ExplainGroupIndexSkipScanAccessPath ( const AccessPath path,
JOIN join,
vector< string > *  description,
vector< ExplainData::Child > *  children 
)
static

◆ ExplainIndexSkipScanAccessPath()

static void ExplainIndexSkipScanAccessPath ( const AccessPath path,
JOIN join,
vector< string > *  description,
vector< ExplainData::Child > *  children 
)
static

◆ ExplainMaterializeAccessPath()

static void ExplainMaterializeAccessPath ( const AccessPath path,
JOIN join,
vector< string > *  description,
vector< ExplainData::Child > *  children 
)
static

◆ GetAccessPathsFromItem()

static void GetAccessPathsFromItem ( Item item_arg,
const char *  source_text,
vector< ExplainData::Child > *  children 
)
static

◆ GetAccessPathsFromSelectList()

vector< ExplainData::Child > GetAccessPathsFromSelectList ( JOIN join)

◆ GetForceSubplanToken()

string GetForceSubplanToken ( AccessPath path,
JOIN join 
)

Generate a digest based on the subplan that the given access path represents.

This can be used by developers to force a given subplan, to investigate e.g. whether a given choice is actually faster in practice, force-apply a plan from the old join optimizer (or at least the types of subplans that are ever considered; e.g. aggregation through temporary tables are not) into the hypergraph join optimizer (to see how it's costed), or whether a given plan is even generated. If DEBUG contains force_subplan_0x<token>, subplans with the given token are unconditionally preferred over all others.

The token returned is “0x<digest>”, where <digest> is the first 64 bits of the SHA-256 sum of this string:

desc1,desc2,...,[child1_desc:]0xchild1,[child2_desc:]0xchild2,<more children>

where desc1, desc2, etc. are the description lines given by EXPLAIN, and 0xchild1 is the token for children. The normal way to generate such tokens is to use SET DEBUG='+d,subplan_tokens' and look at the EXPLAIN FORMAT=tree, but in a pinch, you can also write them by hand and use sha256sum or a similar tool.

Only the hypergraph join optimizer honors token preferences, but EXPLAIN FORMAT=tree shows computed tokens for both optimizers.

◆ HashJoinTypeToString()

static string HashJoinTypeToString ( RelationalExpression::Type  join_type)
static

◆ JoinTypeToString()

static string JoinTypeToString ( JoinType  join_type)
static

◆ PrintQueryPlan()

string PrintQueryPlan ( int  level,
AccessPath path,
JOIN join,
bool  is_root_of_join,
vector< string > *  tokens_for_force_subplan 
)

◆ PrintRanges()

static string PrintRanges ( const QUICK_RANGE *const *  ranges,
unsigned  num_ranges,
const KEY_PART_INFO key_part,
bool  single_part_only 
)
static