24#ifndef SQL_JOIN_OPTIMIZER_COST_MODEL_H_
25#define SQL_JOIN_OPTIMIZER_COST_MODEL_H_
106 THD *thd,
double num_rows,
113 AddCost(thd, subquery, num_rows, &cost);
119 double num_output_rows);
130 std::string *trace =
nullptr);
151 fanout = std::max(fanout, 1.0);
161 fanout = std::min(fanout, 1.0);
167 fanout = std::max(1.0 - fanout, 0.1);
169 return left_rows * fanout;
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1156
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
constexpr double kHashReturnOneRowCost
Definition: cost_model.h:55
constexpr ha_rows kRowEstimateFallback
A fallback cardinality estimate that is used in case the storage engine cannot provide one (like for ...
Definition: cost_model.h:62
void EstimateWindowCost(AccessPath *path)
Estimate the costs and row count for a WINDOW AccessPath.
Definition: cost_model.cc:919
double FindOutputRowsForJoin(double left_rows, double right_rows, const JoinPredicate *edge)
Definition: cost_model.h:143
constexpr size_t kMaxItemLengthEstimate
When we make cost estimates, we use this as the maximal length the values we get from evaluating an I...
Definition: cost_model.h:45
void EstimateAggregateCost(AccessPath *path, const Query_block *query_block, std::string *trace=nullptr)
Estimate costs and result row count for an aggregate operation.
void AddCost(THD *thd, const ContainedSubquery &subquery, double num_rows, FilterCost *cost)
Used internally by EstimateFilterCost() only.
Definition: cost_model.cc:123
constexpr double kHashBuildOneRowCost
Definition: cost_model.h:53
void EstimateLimitOffsetCost(AccessPath *path)
Estimate the costs and row count for a LIMIT_OFFSET AccessPath.
Definition: cost_model.cc:887
constexpr double kWindowOneRowCost
Definition: cost_model.h:57
constexpr double kApplyOneFilterCost
Definition: cost_model.h:50
void EstimateDeleteRowsCost(AccessPath *path)
Definition: cost_model.cc:837
constexpr double kMaterializeOneRowCost
Definition: cost_model.h:56
void EstimateStreamCost(AccessPath *path)
Estimate the costs and row count for a STREAM AccessPath.
Definition: cost_model.cc:871
double EstimateCostForRefAccess(THD *thd, TABLE *table, unsigned key_idx, double num_output_rows)
Definition: cost_model.cc:59
void EstimateUpdateRowsCost(AccessPath *path)
Definition: cost_model.cc:854
void EstimateMaterializeCost(THD *thd, AccessPath *path)
Definition: cost_model.cc:179
constexpr double kHashProbeOneRowCost
Definition: cost_model.h:54
constexpr double kSortOneRowCost
Definition: cost_model.h:52
constexpr double kAggregateOneRowCost
Definition: cost_model.h:51
FilterCost EstimateFilterCost(THD *thd, double num_rows, Item *condition, const Query_block *outer_query_block)
Estimate the cost of evaluating “condition”, “num_rows” times.
Definition: cost_model.cc:164
void EstimateSortCost(AccessPath *path)
Definition: cost_model.cc:92
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
static char * path
Definition: mysqldump.cc:137
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:193
This class represents a subquery contained in some subclass of Item_subselect,.
Definition: item.h:785
See EstimateFilterCost.
Definition: cost_model.h:65
double init_cost_if_not_materialized
Initial cost before the filter can be applied for the first time.
Definition: cost_model.h:75
double cost_to_materialize
Cost of materializing all subqueries present in the filter.
Definition: cost_model.h:84
double cost_if_materialized
Cost of evaluating the filter for all rows if all subqueries in it have been materialized beforehand.
Definition: cost_model.h:80
double cost_if_not_materialized
Cost of evaluating the filter for all rows if subqueries are not materialized.
Definition: cost_model.h:69
A specification that two specific relational expressions (e.g., two tables, or a table and a join bet...
Definition: access_path.h:76
RelationalExpression * expr
Definition: access_path.h:77
double selectivity
Definition: access_path.h:78
enum RelationalExpression::Type type
@ SEMIJOIN
Definition: relational_expression.h:92
@ ANTIJOIN
Definition: relational_expression.h:93
@ LEFT_JOIN
Definition: relational_expression.h:91