MySQL 8.0.39
Source Code Documentation
|
#include "sql/join_optimizer/cost_model.h"
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include "mem_root_deque.h"
#include "my_base.h"
#include "sql/handler.h"
#include "sql/item_func.h"
#include "sql/item_subselect.h"
#include "sql/join_optimizer/access_path.h"
#include "sql/join_optimizer/bit_utils.h"
#include "sql/join_optimizer/find_contained_subqueries.h"
#include "sql/join_optimizer/join_optimizer.h"
#include "sql/join_optimizer/materialize_path_parameters.h"
#include "sql/join_optimizer/overflow_bitset.h"
#include "sql/join_optimizer/print_utils.h"
#include "sql/join_optimizer/relational_expression.h"
#include "sql/mem_root_array.h"
#include "sql/mysqld.h"
#include "sql/opt_costmodel.h"
#include "sql/opt_trace.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_planner.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "template_utils.h"
Classes | |
class | anonymous_namespace{cost_model.cc}::AggregateRowEstimator |
This class finds disjoint sets of aggregation terms that form prefixes of some non-hash index, and makes row estimates for those sets based on index metadata. More... | |
struct | anonymous_namespace{cost_model.cc}::AggregateRowEstimator::Prefix |
A prefix of some key where each key_part corresponds to an aggregation term. More... | |
Namespaces | |
namespace | anonymous_namespace{cost_model.cc} |
Typedefs | |
using | anonymous_namespace{cost_model.cc}::TermArray = Mem_root_array< const Item * > |
Array of aggregation terms. More... | |
Functions | |
double | EstimateCostForRefAccess (THD *thd, TABLE *table, unsigned key_idx, double num_output_rows) |
void | EstimateSortCost (AccessPath *path) |
void | AddCost (THD *thd, const ContainedSubquery &subquery, double num_rows, FilterCost *cost) |
Used internally by EstimateFilterCost() only. More... | |
FilterCost | EstimateFilterCost (THD *thd, double num_rows, Item *condition, const Query_block *outer_query_block) |
Estimate the cost of evaluating “condition”, “num_rows” times. More... | |
void | EstimateMaterializeCost (THD *thd, AccessPath *path) |
double | anonymous_namespace{cost_model.cc}::EstimateAggregateNoRollupRows (const TermArray &terms, double child_rows, string *trace) |
Estimate row count for an aggregate operation (except for any rollup rows). More... | |
template<typename FunctionLow , typename FunctionHigh > | |
double | anonymous_namespace{cost_model.cc}::SmoothTransition (FunctionLow function_low, FunctionHigh function_high, double lower_limit, double upper_limit, double argument) |
For a function f(x) such that: f(x) = g(x) for x<=l f(x) = h(x) for x>l. More... | |
double | anonymous_namespace{cost_model.cc}::EstimateRollupRowsPrimitively (double aggregate_rows, size_t grouping_expressions) |
Do a cheap rollup row estimate for small result sets. More... | |
double | anonymous_namespace{cost_model.cc}::EstimateRollupRowsAdvanced (double aggregate_rows, TermArray &&terms, string *trace) |
Do more precise rollup row estimate for larger result sets. More... | |
double | anonymous_namespace{cost_model.cc}::EstimateAggregateRows (const AccessPath *child, const Query_block *query_block, bool rollup, string *trace) |
Estimate the row count for an aggregate operation (including ROLLUP rows for GROUP BY ... WITH ROLLUP). More... | |
void | EstimateAggregateCost (AccessPath *path, const Query_block *query_block, string *trace) |
void | EstimateDeleteRowsCost (AccessPath *path) |
void | EstimateUpdateRowsCost (AccessPath *path) |
void | EstimateStreamCost (AccessPath *path) |
Estimate the costs and row count for a STREAM AccessPath. More... | |
void | EstimateLimitOffsetCost (AccessPath *path) |
Estimate the costs and row count for a LIMIT_OFFSET AccessPath. More... | |
void | EstimateWindowCost (AccessPath *path) |
Estimate the costs and row count for a WINDOW AccessPath. More... | |
void AddCost | ( | THD * | thd, |
const ContainedSubquery & | subquery, | ||
double | num_rows, | ||
FilterCost * | cost | ||
) |
Used internally by EstimateFilterCost() only.
void EstimateAggregateCost | ( | AccessPath * | path, |
const Query_block * | query_block, | ||
string * | trace | ||
) |
double EstimateCostForRefAccess | ( | THD * | thd, |
TABLE * | table, | ||
unsigned | key_idx, | ||
double | num_output_rows | ||
) |
void EstimateDeleteRowsCost | ( | AccessPath * | path | ) |
FilterCost EstimateFilterCost | ( | THD * | thd, |
double | num_rows, | ||
Item * | condition, | ||
const Query_block * | outer_query_block | ||
) |
Estimate the cost of evaluating “condition”, “num_rows” times.
This is a fairly rudimentary estimation, but it includes the cost of any subqueries that may be present and that need evaluation.
void EstimateLimitOffsetCost | ( | AccessPath * | path | ) |
Estimate the costs and row count for a LIMIT_OFFSET AccessPath.
void EstimateMaterializeCost | ( | THD * | thd, |
AccessPath * | path | ||
) |
void EstimateSortCost | ( | AccessPath * | path | ) |
void EstimateStreamCost | ( | AccessPath * | path | ) |
Estimate the costs and row count for a STREAM AccessPath.
void EstimateUpdateRowsCost | ( | AccessPath * | path | ) |
void EstimateWindowCost | ( | AccessPath * | path | ) |
Estimate the costs and row count for a WINDOW AccessPath.