MySQL 8.0.39
Source Code Documentation
|
#include <string>
#include <vector>
Go to the source code of this file.
Functions | |
std::string | PrintQueryPlan (THD *ethd, const THD *query_thd, Query_expression *unit) |
Print out an access path and all of its children (if any) in a tree. More... | |
std::string | PrintQueryPlan (int level, AccessPath *path, JOIN *join, bool is_root_of_join) |
For debugging purposes. More... | |
std::string | GetForceSubplanToken (AccessPath *path, JOIN *join) |
Generate a digest based on the subplan that the given access path represents. More... | |
std::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.
std::string PrintQueryPlan | ( | int | level, |
AccessPath * | path, | ||
JOIN * | join, | ||
bool | is_root_of_join | ||
) |
For debugging purposes.
std::string PrintQueryPlan | ( | THD * | ethd, |
const THD * | query_thd, | ||
Query_expression * | unit | ||
) |
Print out an access path and all of its children (if any) in a tree.