MySQL 8.3.0
Source Code Documentation
JOIN_TAB Class Reference

Query optimization plan node. More...

#include <sql_select.h>

Inheritance diagram for JOIN_TAB:
[legend]

Public Member Functions

 JOIN_TAB ()
 
void set_table (TABLE *t)
 
void init_join_cond_ref (Table_ref *tl)
 Sets the pointer to the join condition of Table_ref. More...
 
Itemjoin_cond () const
 
void set_join_cond (Item *cond)
 Sets join condition. More...
 
void set_condition (Item *to)
 Set the combined condition for a table (may be performed several times) More...
 
uint use_join_cache () const
 
void set_use_join_cache (uint u)
 
Key_usekeyuse () const
 
void set_keyuse (Key_use *k)
 
void cleanup ()
 Clean up associated table after query execution, including resources. More...
 
uint get_sj_strategy () const
 
- Public Member Functions inherited from QEP_shared_owner
 QEP_shared_owner ()
 
void share_qs (QEP_shared_owner *other)
 Instructs to share the QEP_shared with another owner. More...
 
void set_qs (QEP_shared *q)
 
JOINjoin () const
 
void set_join (JOIN *j)
 
plan_idx idx () const
 
void set_idx (plan_idx i)
 
qep_tab_map idx_map () const
 
TABLEtable () const
 
POSITIONposition () const
 
void set_position (POSITION *p)
 
Semijoin_mat_execsj_mat_exec () const
 
void set_sj_mat_exec (Semijoin_mat_exec *s)
 
plan_idx first_sj_inner () const
 
plan_idx last_sj_inner () const
 
plan_idx first_inner () const
 
plan_idx last_inner () const
 
plan_idx first_upper () const
 
void set_first_inner (plan_idx i)
 
void set_last_inner (plan_idx i)
 
void set_first_sj_inner (plan_idx i)
 
void set_last_sj_inner (plan_idx i)
 
void set_first_upper (plan_idx i)
 
Index_lookupref () const
 
uint index () const
 
void set_index (uint i)
 
enum join_type type () const
 
void set_type (enum join_type t)
 
Itemcondition () const
 
void set_condition (Item *to)
 
bool condition_is_pushed_to_sort () const
 
void mark_condition_as_pushed_to_sort ()
 
Key_mapkeys () const
 
ha_rows records () const
 
void set_records (ha_rows r)
 
AccessPathrange_scan () const
 
void set_range_scan (AccessPath *q)
 
table_map prefix_tables () const
 
table_map added_tables () const
 
Item_func_matchft_func () const
 
void set_ft_func (Item_func_match *f)
 
void set_prefix_tables (table_map prefix_tables, table_map prev_tables)
 
void add_prefix_tables (table_map tables)
 
bool is_single_inner_of_semi_join () const
 
bool is_inner_table_of_outer_join () const
 
bool is_first_inner_for_outer_join () const
 
bool is_single_inner_for_outer_join () const
 
bool has_guarded_conds () const
 
bool and_with_condition (Item *tmp_cond)
 Extend join_tab->cond by AND'ing add_cond to it. More...
 
void set_skip_records_in_range (bool skip_records_in_range)
 
bool skip_records_in_range () const
 
void qs_cleanup ()
 

Public Attributes

Table_reftable_ref
 points to table reference
More...
 
COND_EQUALcond_equal
 multiple equalities for the on expression More...
 
double worst_seeks
 The maximum value for the cost of seek operations for key lookup during ref access. More...
 
Key_map const_keys
 Keys with constant part. More...
 
Key_map checked_keys
 Keys checked. More...
 
Key_map skip_scan_keys
 Keys which can be used for skip scan access. More...
 
Key_map needed_reg
 
Key_map quick_order_tested
 Used to avoid repeated range analysis for the same key in test_if_skip_sort_order(). More...
 
ha_rows found_records
 
double read_time
 
table_map dependent
 The set of tables that this table depends on. More...
 
table_map key_dependent
 The set of tables that are referenced by key from this table. More...
 
uint used_fieldlength
 
enum quick_type use_quick
 
uint m_use_join_cache
 Join buffering strategy. More...
 
Table_refemb_sj_nest
 
nested_join_map embedding_map
 
uint join_cache_flags
 Flags from SE's MRR implementation, to be used by JOIN_CACHE. More...
 
bool reversed_access
 true <=> AM will scan backward More...
 

Private Member Functions

 JOIN_TAB (const JOIN_TAB &)
 
JOIN_TABoperator= (const JOIN_TAB &)
 

Private Attributes

Key_usem_keyuse
 pointer to first used key
More...
 
Item ** m_join_cond_ref
 Pointer to the associated join condition: More...
 

Additional Inherited Members

- Protected Attributes inherited from QEP_shared_owner
QEP_sharedm_qs
 

Detailed Description

Query optimization plan node.

Specifies:

  • a table access operation on the table specified by this node, and
  • a join between the result of the set of previous plan nodes and this plan node.

Constructor & Destructor Documentation

◆ JOIN_TAB() [1/2]

JOIN_TAB::JOIN_TAB ( )
inline

◆ JOIN_TAB() [2/2]

JOIN_TAB::JOIN_TAB ( const JOIN_TAB )
private

Member Function Documentation

◆ join_cond()

Item * JOIN_TAB::join_cond ( ) const
inline
Returns
join condition

◆ keyuse()

Key_use * JOIN_TAB::keyuse ( ) const
inline

◆ operator=()

JOIN_TAB & JOIN_TAB::operator= ( const JOIN_TAB )
private

◆ set_condition()

void JOIN_TAB::set_condition ( Item to)
inline

Set the combined condition for a table (may be performed several times)

◆ set_join_cond()

void JOIN_TAB::set_join_cond ( Item cond)
inline

Sets join condition.

Note
this also changes Table_ref::m_join_cond.

◆ set_keyuse()

void JOIN_TAB::set_keyuse ( Key_use k)
inline

◆ set_use_join_cache()

void JOIN_TAB::set_use_join_cache ( uint  u)
inline

◆ use_join_cache()

uint JOIN_TAB::use_join_cache ( ) const
inline

Member Data Documentation

◆ checked_keys

Key_map JOIN_TAB::checked_keys

Keys checked.

◆ cond_equal

COND_EQUAL* JOIN_TAB::cond_equal

multiple equalities for the on expression

◆ const_keys

Key_map JOIN_TAB::const_keys

Keys with constant part.

Subset of keys.

◆ dependent

table_map JOIN_TAB::dependent

The set of tables that this table depends on.

Used for outer join and straight join dependencies.

◆ emb_sj_nest

Table_ref* JOIN_TAB::emb_sj_nest

◆ embedding_map

nested_join_map JOIN_TAB::embedding_map

◆ found_records

ha_rows JOIN_TAB::found_records

◆ join_cache_flags

uint JOIN_TAB::join_cache_flags

Flags from SE's MRR implementation, to be used by JOIN_CACHE.

◆ key_dependent

table_map JOIN_TAB::key_dependent

The set of tables that are referenced by key from this table.

◆ m_join_cond_ref

Item** JOIN_TAB::m_join_cond_ref
private

Pointer to the associated join condition:

  • if this is a table with position==NULL (e.g. internal sort/group temporary table), pointer is NULL
  • otherwise, pointer is the address of some Table_ref::m_join_cond. Thus, the pointee is the same as Table_ref::m_join_cond (changing one changes the other; thus, optimizations made on the second are reflected in Query_block::print_table_array() which uses the first one).

◆ m_keyuse

Key_use* JOIN_TAB::m_keyuse
private

pointer to first used key

◆ m_use_join_cache

uint JOIN_TAB::m_use_join_cache

Join buffering strategy.

After optimization it contains chosen join buffering strategy (if any).

◆ needed_reg

Key_map JOIN_TAB::needed_reg

◆ quick_order_tested

Key_map JOIN_TAB::quick_order_tested

Used to avoid repeated range analysis for the same key in test_if_skip_sort_order().

This would otherwise happen if the best range access plan found for a key is turned down. quick_order_tested is cleared every time the select condition for this JOIN_TAB changes since a new condition may give another plan and cost from range analysis.

◆ read_time

double JOIN_TAB::read_time

◆ reversed_access

bool JOIN_TAB::reversed_access

true <=> AM will scan backward

◆ skip_scan_keys

Key_map JOIN_TAB::skip_scan_keys

Keys which can be used for skip scan access.

We store it separately from tab->const_keys & join_tab->keys() to avoid unnecessary printing of the prossible keys in EXPLAIN output as some of these keys can be marked not usable for skip scan later. More strict check for prossible keys is performed in get_best_skip_scan() function.

◆ table_ref

Table_ref* JOIN_TAB::table_ref

points to table reference

◆ use_quick

enum quick_type JOIN_TAB::use_quick

◆ used_fieldlength

uint JOIN_TAB::used_fieldlength

◆ worst_seeks

double JOIN_TAB::worst_seeks

The maximum value for the cost of seek operations for key lookup during ref access.

The cost model for ref access assumes every key lookup will cause reading a block from disk. With many key lookups into the same table, most of the blocks will soon be in a memory buffer. As a consequence, there will in most cases be an upper limit on the number of actual disk accesses the ref access will cause. This variable is used for storing a maximum cost estimate for the disk accesses for ref access. It is used for limiting the cost estimate for ref access to a more realistic value than assuming every key lookup causes a random disk access. Without having this upper limit for the cost of ref access, table scan would be more likely to be chosen for cases where ref access performs better.


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