MySQL 8.3.0
Source Code Documentation
CompanionSet Class Referencefinal

RelationalExpression objects in the same companion set are those that are inner-joined against each other; we use this to see in what parts of the graph we allow cycles. More...

#include <relational_expression.h>

Classes

struct  EqualTerm
 This represents equality between a set of fields, i.e. More...
 

Public Member Functions

 CompanionSet ()=default
 
 CompanionSet (THD *thd)
 
 CompanionSet (const CompanionSet &)=delete
 No copying. More...
 
CompanionSetoperator= (const CompanionSet &)=delete
 
void AddEquijoinCondition (THD *thd, const Item_func_eq &eq)
 Add the set of equal fields specified by 'func_eq'. More...
 
table_map GetEqualityMap (const Field &field) const
 If 'field' is part of an equijoin predicate in this CompanionSet, return a table_map of the tables involved in that predicate. More...
 
std::string ToString () const
 For tracing and debugging. More...
 

Private Types

using FieldArray = Mem_root_array< const Field * >
 

Private Attributes

Mem_root_array< EqualTermm_equal_terms
 The set of sets of fields in equijoin predicates in this companion set. More...
 

Detailed Description

RelationalExpression objects in the same companion set are those that are inner-joined against each other; we use this to see in what parts of the graph we allow cycles.

(Within companion sets, we are also allowed to add Cartesian products if we deem that an advantage, but we don't do it currently.) Tables may be alone in their companion sets. Companion sets are also used when calculating selectivity for equijoin predicates using multi-field indexes,

See also
EstimateEqualPredicateSelectivity()).

Member Typedef Documentation

◆ FieldArray

using CompanionSet::FieldArray = Mem_root_array<const Field *>
private

Constructor & Destructor Documentation

◆ CompanionSet() [1/3]

CompanionSet::CompanionSet ( )
default

◆ CompanionSet() [2/3]

CompanionSet::CompanionSet ( THD thd)
inlineexplicit

◆ CompanionSet() [3/3]

CompanionSet::CompanionSet ( const CompanionSet )
delete

No copying.

Member Function Documentation

◆ AddEquijoinCondition()

void CompanionSet::AddEquijoinCondition ( THD thd,
const Item_func_eq eq 
)

Add the set of equal fields specified by 'func_eq'.

◆ GetEqualityMap()

table_map CompanionSet::GetEqualityMap ( const Field field) const

If 'field' is part of an equijoin predicate in this CompanionSet, return a table_map of the tables involved in that predicate.

Otherwise, return 0.

◆ operator=()

CompanionSet & CompanionSet::operator= ( const CompanionSet )
delete

◆ ToString()

std::string CompanionSet::ToString ( ) const

For tracing and debugging.

Returns
A string representation like "{{t1.f1, t2.f2}, {t2.f3, t3.f4}}".

Member Data Documentation

◆ m_equal_terms

Mem_root_array<EqualTerm> CompanionSet::m_equal_terms
private

The set of sets of fields in equijoin predicates in this companion set.

(

See also
EstimateEqualPredicateSelectivity() to see how this is utilized.) For example, if we have:

SELECT ... FROM t1, t2, t3 WHERE t1.x=t2.x AND t2.x=t3.x AND t2.y=t3.y

m_equal_terms will contain:

{{t1.x, t2.x, t3.x}, {t2.y, t3.y}}


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