MySQL 8.0.32
Source Code Documentation
cost_model.cc File Reference

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}::EstimateAggregateRows (const TermArray &terms, double child_rows, string *trace)
 We use the following data to make a row estimate, in that priority: 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...
 

Function Documentation

◆ AddCost()

void AddCost ( THD thd,
const ContainedSubquery subquery,
double  num_rows,
FilterCost cost 
)

Used internally by EstimateFilterCost() only.

◆ EstimateAggregateCost()

void EstimateAggregateCost ( AccessPath path,
const Query_block query_block,
string *  trace 
)

◆ EstimateCostForRefAccess()

double EstimateCostForRefAccess ( THD thd,
TABLE table,
unsigned  key_idx,
double  num_output_rows 
)

◆ EstimateDeleteRowsCost()

void EstimateDeleteRowsCost ( AccessPath path)

◆ EstimateFilterCost()

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.

◆ EstimateLimitOffsetCost()

void EstimateLimitOffsetCost ( AccessPath path)

Estimate the costs and row count for a LIMIT_OFFSET AccessPath.

◆ EstimateMaterializeCost()

void EstimateMaterializeCost ( THD thd,
AccessPath path 
)

◆ EstimateSortCost()

void EstimateSortCost ( AccessPath path)

◆ EstimateStreamCost()

void EstimateStreamCost ( AccessPath path)

Estimate the costs and row count for a STREAM AccessPath.

◆ EstimateUpdateRowsCost()

void EstimateUpdateRowsCost ( AccessPath path)