1#ifndef OPT_COSTCONSTANTS_INCLUDED
2#define OPT_COSTCONSTANTS_INCLUDED
287 double new_value,
bool new_value_is_default);
364 unsigned int storage_class) {
365 assert(cost_constants !=
nullptr);
381 unsigned int storage_class)
const {
480 uint storage_category,
538 uint storage_category,
This class implements a cache for "cost constant sets".
Definition: opt_costconstantcache.h:58
Set of all cost constants used by the server and all storage engines.
Definition: opt_costconstants.h:416
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:283
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:262
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:315
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:332
const Server_cost_constants * get_server_cost_constants() const
Get the cost constants that should be used for server operations.
Definition: opt_costconstants.h:440
unsigned int dec_ref_count()
Decrement the reference counter for this cost constant set.
Definition: opt_costconstants.h:502
Cost_model_constants()
Creates a set with cost constants using the default values defined in the source code.
Definition: opt_costconstants.cc:224
unsigned int m_ref_counter
Reference counter for this set of cost constants.
Definition: opt_costconstants.h:551
void inc_ref_count()
Increment the reference counter for this cost constant set.
Definition: opt_costconstants.h:491
Server_cost_constants m_server_constants
Cost constants for server operations.
Definition: opt_costconstants.h:542
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:548
virtual ~Cost_model_constants()
Destructor.
Definition: opt_costconstants.cc:260
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:288
Class that keeps all cost constants for a storage engine.
Definition: opt_costconstants.h:331
SE_cost_constants * m_se_cost_constants[MAX_STORAGE_CLASSES]
Array of cost constant sets for this storage engine.
Definition: opt_costconstants.h:409
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:380
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:363
Cost_model_se_info()
Constructor that just initializes the class.
Definition: opt_costconstants.cc:212
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:396
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:217
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:70
Cost constants for a storage engine.
Definition: opt_costconstants.h:196
double m_io_block_read_cost
Cost constant for reading a random disk block.
Definition: opt_costconstants.h:308
bool m_io_block_read_cost_default
Whether the io_block_read_cost is a default value or not.
Definition: opt_costconstants.h:319
double m_memory_block_read_cost
Cost constant for reading a random block from an in-memory buffer.
Definition: opt_costconstants.h:305
cost_constant_error update_default(const LEX_CSTRING &name, const double value)
Update the default value of a cost constant.
Definition: opt_costconstants.cc:190
static const double MEMORY_BLOCK_READ_COST
Default cost for reading a random block from an in-memory buffer.
Definition: opt_costconstants.h:295
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:153
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:195
cost_constant_error update(const LEX_CSTRING &name, const double value)
Update the value of a cost constant.
Definition: opt_costconstants.cc:185
double memory_block_read_cost() const
Cost of reading one random block from an in-memory database buffer.
Definition: opt_costconstants.h:210
SE_cost_constants()
Definition: opt_costconstants.h:198
bool m_memory_block_read_cost_default
Whether the memory_block_read_cost is a default value or not.
Definition: opt_costconstants.h:316
double io_block_read_cost() const
Cost of reading one random block from disk.
Definition: opt_costconstants.h:216
static const double IO_BLOCK_READ_COST
Default cost for reading a random disk block.
Definition: opt_costconstants.h:298
Cost constants for operations done by the server.
Definition: opt_costconstants.h:63
double row_evaluate_cost() const
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:80
double m_row_evaluate_cost
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:162
double disk_temptable_row_cost() const
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:114
static const double KEY_COMPARE_COST
Default cost for comparing row ids.
Definition: opt_costconstants.h:137
double memory_temptable_create_cost() const
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:90
static const double MEMORY_TEMPTABLE_CREATE_COST
Cost for creating a memory temporary table.
Definition: opt_costconstants.h:146
static const double ROW_EVALUATE_COST
Default cost for evaluation of the query condition for a row.
Definition: opt_costconstants.h:134
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:174
static const double MEMORY_TEMPTABLE_ROW_COST
Cost for inserting or reading a row in a memory temporary table.
Definition: opt_costconstants.h:149
cost_constant_error set(const LEX_CSTRING &name, const double value)
Set the value of one of the cost constants.
Definition: opt_costconstants.cc:86
static const double DISK_TEMPTABLE_CREATE_COST
Cost for creating a disk temporary table.
Definition: opt_costconstants.h:152
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:98
static const double DISK_TEMPTABLE_ROW_COST
Cost for inserting or reading a row in a disk temporary table.
Definition: opt_costconstants.h:155
double m_disk_temptable_row_cost
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:186
double m_disk_temptable_create_cost
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:180
double m_key_compare_cost
Cost for comparing two keys.
Definition: opt_costconstants.h:165
Server_cost_constants()
Creates a server cost constants object using the default values defined in this class.
Definition: opt_costconstants.h:69
double disk_temptable_create_cost() const
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:106
double m_memory_temptable_create_cost
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:168
double key_compare_cost() const
Cost for comparing two keys.
Definition: opt_costconstants.h:85
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
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:57
cost_constant_error
Error codes returned from the functions that do updates of the cost constants.
Definition: opt_costconstants.h:42
@ INVALID_COST_VALUE
Definition: opt_costconstants.h:46
@ UNKNOWN_COST_NAME
Definition: opt_costconstants.h:44
@ UNKNOWN_ENGINE_NAME
Definition: opt_costconstants.h:45
@ INVALID_DEVICE_TYPE
Definition: opt_costconstants.h:47
@ COST_CONSTANT_OK
Definition: opt_costconstants.h:43
case opt name
Definition: sslopt-case.h:32
Definition: mysql_lex_string.h:39
unsigned int uint
Definition: uca-dump.cc:29