MySQL 8.0.37
Source Code Documentation
SE_cost_constants Class Reference

Cost constants for a storage engine. More...

#include <opt_costconstants.h>

Public Member Functions

 SE_cost_constants ()
 
virtual ~SE_cost_constants ()=default
 
double memory_block_read_cost () const
 Cost of reading one random block from an in-memory database buffer. More...
 
double io_block_read_cost () const
 Cost of reading one random block from disk. More...
 

Protected Member Functions

virtual cost_constant_error set (const LEX_CSTRING &name, const double value, bool default_value)
 Set the value of one of the cost constants. More...
 
cost_constant_error update (const LEX_CSTRING &name, const double value)
 Update the value of a cost constant. More...
 
cost_constant_error update_default (const LEX_CSTRING &name, const double value)
 Update the default value of a cost constant. More...
 
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. More...
 

Private Attributes

double m_memory_block_read_cost
 Cost constant for reading a random block from an in-memory buffer. More...
 
double m_io_block_read_cost
 Cost constant for reading a random disk block. More...
 
bool m_memory_block_read_cost_default
 Whether the memory_block_read_cost is a default value or not. More...
 
bool m_io_block_read_cost_default
 Whether the io_block_read_cost is a default value or not. More...
 

Static Private Attributes

static const double MEMORY_BLOCK_READ_COST = 0.25
 Default cost for reading a random block from an in-memory buffer. More...
 
static const double IO_BLOCK_READ_COST = 1.0
 Default cost for reading a random disk block. More...
 

Friends

class Cost_model_constants
 

Detailed Description

Cost constants for a storage engine.

Storage engines that want to add new cost constants should make a subclass of this class.

Constructor & Destructor Documentation

◆ SE_cost_constants()

SE_cost_constants::SE_cost_constants ( )
inline

◆ ~SE_cost_constants()

virtual SE_cost_constants::~SE_cost_constants ( )
virtualdefault

Member Function Documentation

◆ io_block_read_cost()

double SE_cost_constants::io_block_read_cost ( ) const
inline

Cost of reading one random block from disk.

◆ memory_block_read_cost()

double SE_cost_constants::memory_block_read_cost ( ) const
inline

Cost of reading one random block from an in-memory database buffer.

◆ set()

cost_constant_error SE_cost_constants::set ( const LEX_CSTRING name,
const double  value,
bool  default_value 
)
protectedvirtual

Set the value of one of the cost constants.

If a storage engine wants to introduce a new cost constant, it should provide an implementation of this function. If the cost constant is not recognized by the function in the subclass, then this function should be called to allow the cost constant in the base class to be given the updated value.

Parameters
namename of cost constant
valuenew value
default_valuespecify whether the new value is a default value or an engine specific value
Returns
Status for updating the cost constant

◆ update()

cost_constant_error SE_cost_constants::update ( const LEX_CSTRING name,
const double  value 
)
protected

Update the value of a cost constant.

Parameters
namename of the cost constant
valuethe new value this cost constant should take
Returns
Status for updating the cost constant

◆ update_cost_value()

void SE_cost_constants::update_cost_value ( double *  cost_constant,
bool *  cost_constant_is_default,
double  new_value,
bool  new_value_is_default 
)
protected

Utility function for changing the value of a cost constant.

The cost constant will be updated to the new value iff: a) the current value is the default value, or b) the current value is not the default value and the new value is not a default value

Parameters
[out]cost_constantpointer to the cost constant that should be updated
[in,out]cost_constant_is_defaultwhether the current value has the default value or not
new_valuethe new value for the cost constant
new_value_is_defaultwhether this is a new default value or not

◆ update_default()

cost_constant_error SE_cost_constants::update_default ( const LEX_CSTRING name,
const double  value 
)
protected

Update the default value of a cost constant.

If this const constant already has been given a non-default value, then calling this will have no effect on the current value for the cost constant.

Parameters
namename of the cost constant
valuethe new value this cost constant should take
Returns
Status for updating the cost constant

Friends And Related Function Documentation

◆ Cost_model_constants

friend class Cost_model_constants
friend

Member Data Documentation

◆ IO_BLOCK_READ_COST

const double SE_cost_constants::IO_BLOCK_READ_COST = 1.0
staticprivate

Default cost for reading a random disk block.

◆ m_io_block_read_cost

double SE_cost_constants::m_io_block_read_cost
private

Cost constant for reading a random disk block.

◆ m_io_block_read_cost_default

bool SE_cost_constants::m_io_block_read_cost_default
private

Whether the io_block_read_cost is a default value or not.

◆ m_memory_block_read_cost

double SE_cost_constants::m_memory_block_read_cost
private

Cost constant for reading a random block from an in-memory buffer.

◆ m_memory_block_read_cost_default

bool SE_cost_constants::m_memory_block_read_cost_default
private

Whether the memory_block_read_cost is a default value or not.

◆ MEMORY_BLOCK_READ_COST

const double SE_cost_constants::MEMORY_BLOCK_READ_COST = 0.25
staticprivate

Default cost for reading a random block from an in-memory buffer.


The documentation for this class was generated from the following files: