MySQL 9.5.0
Source Code Documentation
IndexSkipScanCost Class Reference

Manage cost-related info and cost calculation functions for index skip scans. More...

#include <index_skip_scan_plan.h>

Classes

struct  IndexSkipScanCardinality
 

Public Member Functions

 IndexSkipScanCost (TABLE *tab, uint cur_key, uint keyparts, ha_rows prefix_records, Item *where, Opt_trace_object *trace_idx)
 
Cost_estimate GetCost () const
 DESCRIPTION This method computes the access cost of an INDEX_SKIP_SCAN access path and the number of rows returned for the old optimizer. More...
 
double GetCostForHypergraph () const
 DESCRIPTION This method computes the access cost of an INDEX_SKIP_SCAN access path and the number of rows returned in hypergraph. More...
 
ha_rows GetNumRecords () const
 

Private Member Functions

void CalcCardinality ()
 DESCRIPTION This method computes the parameters used to calculate the access cost of an INDEX_SKIP_SCAN access path and the number of rows returned. More...
 

Private Attributes

TABLEm_table
 
uint m_key
 
uint m_distinct_key_parts
 
ha_rows m_quick_prefix_records
 
Itemm_where_cond
 
Opt_trace_objectm_trace
 
struct IndexSkipScanCost::IndexSkipScanCardinality m_cardinality
 

Detailed Description

Manage cost-related info and cost calculation functions for index skip scans.

Constructor & Destructor Documentation

◆ IndexSkipScanCost()

IndexSkipScanCost::IndexSkipScanCost ( TABLE tab,
uint  cur_key,
uint  keyparts,
ha_rows  prefix_records,
Item where,
Opt_trace_object trace_idx 
)
inline

Member Function Documentation

◆ CalcCardinality()

void IndexSkipScanCost::CalcCardinality ( )
private

DESCRIPTION This method computes the parameters used to calculate the access cost of an INDEX_SKIP_SCAN access path and the number of rows returned.

NOTES To estimate the size of the groups to read, index statistics from rec_per_key is used. Each equality range decreases number of the groups to read. The total number of processed records from all the groups will be quick_prefix_records if there are equality ranges else it will be the entire table. Number of distinct group is calculated by dividing the number of processed record by the number keys in a group.

Number of processed records is calculated using following formula:

records = number_of_distinct_groups * records_per_group * filtering_effect

where filtering_effect is filtering effect of the range condition.

◆ GetCost()

Cost_estimate IndexSkipScanCost::GetCost ( ) const

DESCRIPTION This method computes the access cost of an INDEX_SKIP_SCAN access path and the number of rows returned for the old optimizer.

RETURN Cost estimate

◆ GetCostForHypergraph()

double IndexSkipScanCost::GetCostForHypergraph ( ) const

DESCRIPTION This method computes the access cost of an INDEX_SKIP_SCAN access path and the number of rows returned in hypergraph.

RETURN Hypergraph cost value.

◆ GetNumRecords()

ha_rows IndexSkipScanCost::GetNumRecords ( ) const
inline

Member Data Documentation

◆ m_cardinality

struct IndexSkipScanCost::IndexSkipScanCardinality IndexSkipScanCost::m_cardinality
private

◆ m_distinct_key_parts

uint IndexSkipScanCost::m_distinct_key_parts
private

◆ m_key

uint IndexSkipScanCost::m_key
private

◆ m_quick_prefix_records

ha_rows IndexSkipScanCost::m_quick_prefix_records
private

◆ m_table

TABLE* IndexSkipScanCost::m_table
private

◆ m_trace

Opt_trace_object* IndexSkipScanCost::m_trace
private

◆ m_where_cond

Item* IndexSkipScanCost::m_where_cond
private

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