1#ifndef OPT_COSTCONSTANTS_INCLUDED
2#define OPT_COSTCONSTANTS_INCLUDED
325 double new_value,
bool new_value_is_default);
383 unsigned int storage_class) {
384 assert(cost_constants !=
nullptr);
400 unsigned int storage_class)
const {
499 uint storage_category,
557 uint storage_category,
This class implements a cache for "cost constant sets".
Definition: opt_costconstantcache.h:59
Set of all cost constants used by the server and all storage engines.
Definition: opt_costconstants.h:435
cost_constant_error update_server_cost_constant(const LEX_CSTRING &name, double value)
Update the value for one of the server cost constants.
Definition: opt_costconstants.cc:232
Optimizer m_optimizer
Optimizer type.
Definition: opt_costconstants.h:573
Cost_model_constants(Optimizer optimizer)
Creates a set with cost constants using the default values defined in the source code.
Definition: opt_costconstants.cc:166
const SE_cost_constants * get_se_cost_constants(const TABLE *table) const
Return the cost constants that should be used for a given table.
Definition: opt_costconstants.cc:207
virtual uint find_handler_slot_from_name(THD *thd, const LEX_CSTRING &name) const
Utility function for finding the slot number for a storage engine based on the storage engine name.
Definition: opt_costconstants.cc:264
cost_constant_error update_engine_default_cost(const LEX_CSTRING &name, uint storage_category, double value)
Update the default value for a storage engine cost constant.
Definition: opt_costconstants.cc:281
const Server_cost_constants * get_server_cost_constants() const
Get the cost constants that should be used for server operations.
Definition: opt_costconstants.h:459
unsigned int dec_ref_count()
Decrement the reference counter for this cost constant set.
Definition: opt_costconstants.h:521
unsigned int m_ref_counter
Reference counter for this set of cost constants.
Definition: opt_costconstants.h:570
void inc_ref_count()
Increment the reference counter for this cost constant set.
Definition: opt_costconstants.h:510
Server_cost_constants m_server_constants
Cost constants for server operations.
Definition: opt_costconstants.h:561
Prealloced_array< Cost_model_se_info, 15 > m_engines
Cost constants for storage engines 15 should be enough for most use cases, see PREALLOC_NUM_HA.
Definition: opt_costconstants.h:567
virtual ~Cost_model_constants()
Destructor.
Definition: opt_costconstants.cc:205
cost_constant_error update_engine_cost_constant(THD *thd, const LEX_CSTRING &se_name, uint storage_category, const LEX_CSTRING &name, double value)
Update the value for one of the storage engine cost constants.
Definition: opt_costconstants.cc:237
Class that keeps all cost constants for a storage engine.
Definition: opt_costconstants.h:350
SE_cost_constants * m_se_cost_constants[MAX_STORAGE_CLASSES]
Array of cost constant sets for this storage engine.
Definition: opt_costconstants.h:428
const SE_cost_constants * get_cost_constants(unsigned int storage_class) const
Retrieve the cost constants to be used for this storage engine for a specified storage class.
Definition: opt_costconstants.h:399
void set_cost_constants(SE_cost_constants *cost_constants, unsigned int storage_class)
Set the storage constants to be used for a given storage type for this storage engine.
Definition: opt_costconstants.h:382
Cost_model_se_info()
Constructor that just initializes the class.
Definition: opt_costconstants.cc:154
SE_cost_constants * get_cost_constants(unsigned int storage_class)
Retrieve the cost constants to be used for this storage engine for a specified storage class.
Definition: opt_costconstants.h:415
Cost_model_se_info & operator=(const Cost_model_se_info &rhs)
Cost_model_se_info(const Cost_model_se_info &)
~Cost_model_se_info()
Destructor.
Definition: opt_costconstants.cc:159
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
Cost constants for a storage engine.
Definition: opt_costconstants.h:208
double m_io_block_read_cost
Cost constant for reading a random disk block.
Definition: opt_costconstants.h:332
bool m_io_block_read_cost_default
Whether the io_block_read_cost is a default value or not.
Definition: opt_costconstants.h:338
double m_memory_block_read_cost
Cost constant for reading a random block from an in-memory buffer.
Definition: opt_costconstants.h:329
cost_constant_error update_default(const LEX_CSTRING &name, const double value)
Update the default value of a cost constant.
Definition: opt_costconstants.cc:132
virtual ~SE_cost_constants()=default
virtual cost_constant_error set(const LEX_CSTRING &name, const double value, bool default_value)
Set the value of one of the cost constants.
Definition: opt_costconstants.cc:95
void update_cost_value(double *cost_constant, bool *cost_constant_is_default, double new_value, bool new_value_is_default)
Utility function for changing the value of a cost constant.
Definition: opt_costconstants.cc:137
cost_constant_error update(const LEX_CSTRING &name, const double value)
Update the value of a cost constant.
Definition: opt_costconstants.cc:127
double memory_block_read_cost() const
Cost of reading one random block from an in-memory database buffer.
Definition: opt_costconstants.h:248
SE_cost_constants(Optimizer optimizer)
Creates a storage engine cost constants object with default values.
Definition: opt_costconstants.h:222
bool m_memory_block_read_cost_default
Whether the memory_block_read_cost is a default value or not.
Definition: opt_costconstants.h:335
double io_block_read_cost() const
Cost of reading one random block from disk.
Definition: opt_costconstants.h:254
Cost constants for operations done by the server.
Definition: opt_costconstants.h:66
double row_evaluate_cost() const
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:109
double m_row_evaluate_cost
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:158
double disk_temptable_row_cost() const
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:143
Server_cost_constants(Optimizer optimizer)
Creates a server cost constants object with default values.
Definition: opt_costconstants.h:80
double memory_temptable_create_cost() const
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:119
double m_memory_temptable_row_cost
Cost for retrieving or storing a row in an internal temporary table stored in memory.
Definition: opt_costconstants.h:178
cost_constant_error set(const LEX_CSTRING &name, const double value)
Set the value of one of the cost constants.
Definition: opt_costconstants.cc:42
double memory_temptable_row_cost() const
Cost for retrieving or storing a row in an internal temporary table stored in memory.
Definition: opt_costconstants.h:127
double m_disk_temptable_row_cost
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:199
double m_disk_temptable_create_cost
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:188
double m_key_compare_cost
Cost for comparing two keys.
Definition: opt_costconstants.h:161
double disk_temptable_create_cost() const
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:135
double m_memory_temptable_create_cost
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:169
double key_compare_cost() const
Cost for comparing two keys.
Definition: opt_costconstants.h:114
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Hypergraph optimizer cost constants.
constexpr double kUnitCostInMicroseconds
We define the cost unit for the MySQL hypergraph cost model as follows: A cost of 1....
Definition: cost_constants.h:62
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Optimizer
Definition: opt_costconstants.h:39
const unsigned int MAX_STORAGE_CLASSES
The cost model should support different types of storage devices each with different cost constants.
Definition: opt_costconstants.h:60
cost_constant_error
Error codes returned from the functions that do updates of the cost constants.
Definition: opt_costconstants.h:45
@ INVALID_COST_VALUE
Definition: opt_costconstants.h:49
@ UNKNOWN_COST_NAME
Definition: opt_costconstants.h:47
@ UNKNOWN_ENGINE_NAME
Definition: opt_costconstants.h:48
@ INVALID_DEVICE_TYPE
Definition: opt_costconstants.h:50
@ COST_CONSTANT_OK
Definition: opt_costconstants.h:46
case opt name
Definition: sslopt-case.h:29
Definition: mysql_lex_string.h:40