1#ifndef OPT_COSTCONSTANTS_INCLUDED
2#define OPT_COSTCONSTANTS_INCLUDED
288 double new_value,
bool new_value_is_default);
365 unsigned int storage_class) {
366 assert(cost_constants !=
nullptr);
382 unsigned int storage_class)
const {
481 uint storage_category,
539 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:417
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:284
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:263
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:316
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:333
const Server_cost_constants * get_server_cost_constants() const
Get the cost constants that should be used for server operations.
Definition: opt_costconstants.h:441
unsigned int dec_ref_count()
Decrement the reference counter for this cost constant set.
Definition: opt_costconstants.h:503
Cost_model_constants()
Creates a set with cost constants using the default values defined in the source code.
Definition: opt_costconstants.cc:225
unsigned int m_ref_counter
Reference counter for this set of cost constants.
Definition: opt_costconstants.h:552
void inc_ref_count()
Increment the reference counter for this cost constant set.
Definition: opt_costconstants.h:492
Server_cost_constants m_server_constants
Cost constants for server operations.
Definition: opt_costconstants.h:543
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:549
virtual ~Cost_model_constants()
Destructor.
Definition: opt_costconstants.cc:261
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:289
Class that keeps all cost constants for a storage engine.
Definition: opt_costconstants.h:332
SE_cost_constants * m_se_cost_constants[MAX_STORAGE_CLASSES]
Array of cost constant sets for this storage engine.
Definition: opt_costconstants.h:410
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:381
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:364
Cost_model_se_info()
Constructor that just initializes the class.
Definition: opt_costconstants.cc:213
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:397
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:218
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
Cost constants for a storage engine.
Definition: opt_costconstants.h:197
double m_io_block_read_cost
Cost constant for reading a random disk block.
Definition: opt_costconstants.h:309
bool m_io_block_read_cost_default
Whether the io_block_read_cost is a default value or not.
Definition: opt_costconstants.h:320
double m_memory_block_read_cost
Cost constant for reading a random block from an in-memory buffer.
Definition: opt_costconstants.h:306
cost_constant_error update_default(const LEX_CSTRING &name, const double value)
Update the default value of a cost constant.
Definition: opt_costconstants.cc:191
static const double MEMORY_BLOCK_READ_COST
Default cost for reading a random block from an in-memory buffer.
Definition: opt_costconstants.h:296
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:154
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:196
cost_constant_error update(const LEX_CSTRING &name, const double value)
Update the value of a cost constant.
Definition: opt_costconstants.cc:186
double memory_block_read_cost() const
Cost of reading one random block from an in-memory database buffer.
Definition: opt_costconstants.h:211
SE_cost_constants()
Definition: opt_costconstants.h:199
bool m_memory_block_read_cost_default
Whether the memory_block_read_cost is a default value or not.
Definition: opt_costconstants.h:317
double io_block_read_cost() const
Cost of reading one random block from disk.
Definition: opt_costconstants.h:217
static const double IO_BLOCK_READ_COST
Default cost for reading a random disk block.
Definition: opt_costconstants.h:299
Cost constants for operations done by the server.
Definition: opt_costconstants.h:64
double row_evaluate_cost() const
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:81
double m_row_evaluate_cost
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:163
double disk_temptable_row_cost() const
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:115
static const double KEY_COMPARE_COST
Default cost for comparing row ids.
Definition: opt_costconstants.h:138
double memory_temptable_create_cost() const
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:91
static const double MEMORY_TEMPTABLE_CREATE_COST
Cost for creating a memory temporary table.
Definition: opt_costconstants.h:147
static const double ROW_EVALUATE_COST
Default cost for evaluation of the query condition for a row.
Definition: opt_costconstants.h:135
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:175
static const double MEMORY_TEMPTABLE_ROW_COST
Cost for inserting or reading a row in a memory temporary table.
Definition: opt_costconstants.h:150
cost_constant_error set(const LEX_CSTRING &name, const double value)
Set the value of one of the cost constants.
Definition: opt_costconstants.cc:87
static const double DISK_TEMPTABLE_CREATE_COST
Cost for creating a disk temporary table.
Definition: opt_costconstants.h:153
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:99
static const double DISK_TEMPTABLE_ROW_COST
Cost for inserting or reading a row in a disk temporary table.
Definition: opt_costconstants.h:156
double m_disk_temptable_row_cost
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:187
double m_disk_temptable_create_cost
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:181
double m_key_compare_cost
Cost for comparing two keys.
Definition: opt_costconstants.h:166
Server_cost_constants()
Creates a server cost constants object using the default values defined in this class.
Definition: opt_costconstants.h:70
double disk_temptable_create_cost() const
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:107
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:86
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
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:58
cost_constant_error
Error codes returned from the functions that do updates of the cost constants.
Definition: opt_costconstants.h:43
@ INVALID_COST_VALUE
Definition: opt_costconstants.h:47
@ UNKNOWN_COST_NAME
Definition: opt_costconstants.h:45
@ UNKNOWN_ENGINE_NAME
Definition: opt_costconstants.h:46
@ INVALID_DEVICE_TYPE
Definition: opt_costconstants.h:48
@ COST_CONSTANT_OK
Definition: opt_costconstants.h:44
case opt name
Definition: sslopt-case.h:33
Definition: mysql_lex_string.h:40
unsigned int uint
Definition: uca9-dump.cc:75