1#ifndef OPT_COSTCONSTANTS_INCLUDED
2#define OPT_COSTCONSTANTS_INCLUDED
314 double new_value,
bool new_value_is_default);
372 unsigned int storage_class) {
373 assert(cost_constants !=
nullptr);
389 unsigned int storage_class)
const {
488 uint storage_category,
546 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:424
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:562
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:448
unsigned int dec_ref_count()
Decrement the reference counter for this cost constant set.
Definition: opt_costconstants.h:510
unsigned int m_ref_counter
Reference counter for this set of cost constants.
Definition: opt_costconstants.h:559
void inc_ref_count()
Increment the reference counter for this cost constant set.
Definition: opt_costconstants.h:499
Server_cost_constants m_server_constants
Cost constants for server operations.
Definition: opt_costconstants.h:550
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:556
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:339
SE_cost_constants * m_se_cost_constants[MAX_STORAGE_CLASSES]
Array of cost constant sets for this storage engine.
Definition: opt_costconstants.h:417
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:388
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:371
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:404
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:202
double m_io_block_read_cost
Cost constant for reading a random disk block.
Definition: opt_costconstants.h:321
bool m_io_block_read_cost_default
Whether the io_block_read_cost is a default value or not.
Definition: opt_costconstants.h:327
double m_memory_block_read_cost
Cost constant for reading a random block from an in-memory buffer.
Definition: opt_costconstants.h:318
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:237
SE_cost_constants(Optimizer optimizer)
Creates a storage engine cost constants object with default values.
Definition: opt_costconstants.h:216
bool m_memory_block_read_cost_default
Whether the memory_block_read_cost is a default value or not.
Definition: opt_costconstants.h:324
double io_block_read_cost() const
Cost of reading one random block from disk.
Definition: opt_costconstants.h:243
Cost constants for operations done by the server.
Definition: opt_costconstants.h:65
double row_evaluate_cost() const
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:103
double m_row_evaluate_cost
Cost for evaluating the query condition on a row.
Definition: opt_costconstants.h:152
double disk_temptable_row_cost() const
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:137
Server_cost_constants(Optimizer optimizer)
Creates a server cost constants object with default values.
Definition: opt_costconstants.h:79
double memory_temptable_create_cost() const
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:113
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:172
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:121
double m_disk_temptable_row_cost
Cost for retrieving or storing a row in an internal disk resident temporary table.
Definition: opt_costconstants.h:193
double m_disk_temptable_create_cost
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:182
double m_key_compare_cost
Cost for comparing two keys.
Definition: opt_costconstants.h:155
double disk_temptable_create_cost() const
Cost for creating an internal temporary table in a disk resident storage engine.
Definition: opt_costconstants.h:129
double m_memory_temptable_create_cost
Cost for creating an internal temporary table in memory.
Definition: opt_costconstants.h:163
double key_compare_cost() const
Cost for comparing two keys.
Definition: opt_costconstants.h:108
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Optimizer
Definition: opt_costconstants.h:38
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:59
cost_constant_error
Error codes returned from the functions that do updates of the cost constants.
Definition: opt_costconstants.h:44
@ INVALID_COST_VALUE
Definition: opt_costconstants.h:48
@ UNKNOWN_COST_NAME
Definition: opt_costconstants.h:46
@ UNKNOWN_ENGINE_NAME
Definition: opt_costconstants.h:47
@ INVALID_DEVICE_TYPE
Definition: opt_costconstants.h:49
@ COST_CONSTANT_OK
Definition: opt_costconstants.h:45
case opt name
Definition: sslopt-case.h:29
Definition: mysql_lex_string.h:40