MySQL 26.7.0
Source Code Documentation
HashJoinCost Class Referencefinal

This class represents the cost of a hash join (excluding the cost of sub-paths). More...

#include <cost_model.h>

Public Member Functions

 HashJoinCost (THD *thd, const HashJoinMetrics &metrics, bool allow_spill_to_disk=true)
 
double spill_to_disk_probability () const
 
double init_cost () const
 
double cost () const
 
double probe_iterations () const
 The number of times the probe input must be scanned. More...
 
double overflow_probability () const
 Estimated probability that the build input overflows one join buffer. More...
 

Private Attributes

double m_spill_to_disk_probability
 The probability (range [0.0, 1.0]) of needing spill to disk. More...
 
double m_overflow_probability {0.0}
 The probability (range [0.0, 1.0]) that the build input overflows one join buffer, regardless of whether spill-to-disk is allowed. More...
 
double m_init_cost
 The cost of preparing to produce the first result row. More...
 
double m_cost
 The cost of the hash join. More...
 
double m_probe_iterations
 The number of iterations over the probe input. More...
 

Detailed Description

This class represents the cost of a hash join (excluding the cost of sub-paths).

Constructor & Destructor Documentation

◆ HashJoinCost()

HashJoinCost::HashJoinCost ( THD thd,
const HashJoinMetrics metrics,
bool  allow_spill_to_disk = true 
)

Member Function Documentation

◆ cost()

double HashJoinCost::cost ( ) const
inline

◆ init_cost()

double HashJoinCost::init_cost ( ) const
inline

◆ overflow_probability()

double HashJoinCost::overflow_probability ( ) const
inline

Estimated probability that the build input overflows one join buffer.

Unlike spill_to_disk_probability(), this is independent of allow_spill_to_disk: a no-spill plan with overflow_probability()>0 will refill the hash table rather than write chunk files, but the in-memory buffer is still not reusable across re-Init() in that case.

◆ probe_iterations()

double HashJoinCost::probe_iterations ( ) const
inline

The number of times the probe input must be scanned.

Greater than 1 when the build input does not fit in the join buffer and we need multiple passes (with hash table refills).

◆ spill_to_disk_probability()

double HashJoinCost::spill_to_disk_probability ( ) const
inline

Member Data Documentation

◆ m_cost

double HashJoinCost::m_cost
private

The cost of the hash join.

◆ m_init_cost

double HashJoinCost::m_init_cost
private

The cost of preparing to produce the first result row.

◆ m_overflow_probability

double HashJoinCost::m_overflow_probability {0.0}
private

The probability (range [0.0, 1.0]) that the build input overflows one join buffer, regardless of whether spill-to-disk is allowed.

◆ m_probe_iterations

double HashJoinCost::m_probe_iterations
private

The number of iterations over the probe input.

Used by ProposeHashJoin() to account for probe re-scanning cost.

◆ m_spill_to_disk_probability

double HashJoinCost::m_spill_to_disk_probability
private

The probability (range [0.0, 1.0]) of needing spill to disk.


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