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);
 
  223      return left_rows * std::max(right_rows * edge->
selectivity, 1.0);
 
constexpr double kUnknownRowCount
To indicate that a row estimate is not yet made.
Definition: access_path.h:184
 
A wrapper class which provides array bounds checking.
Definition: sql_array.h:47
 
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
 
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:1167
 
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
 
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 EstimateSortCost(THD *thd, AccessPath *path, double distinct_rows=kUnknownRowCount)
Estimate costs and output rows for a SORT AccessPath.
Definition: cost_model.cc:96
 
void EstimateWindowCost(AccessPath *path)
Estimate the costs and row count for a WINDOW AccessPath.
Definition: cost_model.cc:975
 
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 AddCost(THD *thd, const ContainedSubquery &subquery, double num_rows, FilterCost *cost)
Used internally by EstimateFilterCost() only.
Definition: cost_model.cc:153
 
constexpr double kHashBuildOneRowCost
Definition: cost_model.h:53
 
void EstimateLimitOffsetCost(AccessPath *path)
Estimate the costs and row count for a WINDOW AccessPath.
Definition: cost_model.cc:941
 
constexpr double kWindowOneRowCost
Definition: cost_model.h:57
 
constexpr double kApplyOneFilterCost
Definition: cost_model.h:50
 
void EstimateDeleteRowsCost(AccessPath *path)
Definition: cost_model.cc:891
 
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:925
 
double EstimateCostForRefAccess(THD *thd, TABLE *table, unsigned key_idx, double num_output_rows)
Definition: cost_model.cc:63
 
double FindOutputRowsForJoin(THD *thd, double left_rows, double right_rows, const JoinPredicate *edge)
Estimate the number of output rows from joining two relations.
Definition: cost_model.h:214
 
void EstimateUpdateRowsCost(AccessPath *path)
Definition: cost_model.cc:908
 
void EstimateMaterializeCost(THD *thd, AccessPath *path)
Definition: cost_model.cc:209
 
constexpr double kHashProbeOneRowCost
Definition: cost_model.h:54
 
constexpr double kSortOneRowCost
Definition: cost_model.h:52
 
double EstimateDistinctRows(THD *thd, double child_rows, Bounds_checked_array< const Item *const > terms)
Estimate the number of rows with a distinct combination of values for 'terms'.
 
constexpr double kAggregateOneRowCost
Definition: cost_model.h:51
 
void EstimateAggregateCost(THD *thd, AccessPath *path, const Query_block *query_block)
Estimate costs and result row count for an aggregate operation.
Definition: cost_model.cc:872
 
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:194
 
double EstimateSemijoinFanOut(THD *thd, double right_rows, const JoinPredicate &edge)
Estimate the fan out for a left semijoin or a left antijoin.
Definition: cost_model.cc:985
 
This file includes constants used by all storage engines.
 
my_off_t ha_rows
Definition: my_base.h:1141
 
static char * path
Definition: mysqldump.cc:149
 
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
 
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:213
 
This class represents a subquery contained in some subclass of Item_subselect,.
Definition: item.h:868
 
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:78
 
RelationalExpression * expr
Definition: access_path.h:79
 
double selectivity
Definition: access_path.h:80
 
enum RelationalExpression::Type type
 
@ SEMIJOIN
Left semijoin.
Definition: relational_expression.h:151
 
@ MULTI_INNER_JOIN
Definition: relational_expression.h:173
 
@ STRAIGHT_INNER_JOIN
Definition: relational_expression.h:159
 
@ ANTIJOIN
Left antijoin.
Definition: relational_expression.h:154
 
@ INNER_JOIN
Definition: relational_expression.h:147
 
@ FULL_OUTER_JOIN
Definition: relational_expression.h:166
 
@ TABLE
Definition: relational_expression.h:175
 
@ LEFT_JOIN
Definition: relational_expression.h:148