MySQL  8.0.19
Source Code Documentation
QEP_TAB Class Reference

#include <sql_executor.h>

Inheritance diagram for QEP_TAB:
QEP_shared_owner

Public Types

typedef int(* Setup_func) (QEP_TAB *)
 

Public Member Functions

 QEP_TAB ()
 
void init (JOIN_TAB *jt)
 Initializes the object from a JOIN_TAB. More...
 
void cleanup ()
 
Itemcondition_optim () const
 
QUICK_SELECT_Iquick_optim () const
 
void set_quick_optim ()
 
void set_condition_optim ()
 
bool keyread_optim () const
 
void set_keyread_optim ()
 
bool reversed_access () const
 
void set_reversed_access (bool arg)
 
void set_table (TABLE *t)
 
bool temporary_table_deduplicates () const
 
void set_temporary_table_deduplicates (bool arg)
 
bool using_table_scan () const
 
void set_using_table_scan (bool arg)
 
uint get_sj_strategy () const
 
bool do_firstmatch () const
 Return true if join_tab should perform a FirstMatch action. More...
 
bool do_loosescan () const
 Return true if join_tab should perform a LooseScan action. More...
 
bool starts_weedout () const
 Return true if join_tab starts a Duplicate Weedout action. More...
 
bool finishes_weedout () const
 Return true if join_tab finishes a Duplicate Weedout action. More...
 
bool prepare_scan ()
 Prepare table to be scanned. More...
 
void refresh_lateral ()
 Instructs each lateral derived table depending on this QEP_TAB, to rematerialize itself before emitting rows. More...
 
void init_join_cache (JOIN_TAB *join_tab)
 A helper function that allocates appropriate join cache object and sets next_select function of previous tab. More...
 
uint sjm_query_block_id () const
 
bool dynamic_range () const
 
bool use_order () const
 Use ordering provided by chosen index? More...
 
bool remove_duplicates ()
 
void restore_quick_optim_and_condition ()
 Used to begin a new execution of a subquery. More...
 
void pick_table_access_method ()
 Pick the appropriate access method functions. More...
 
void push_index_cond (const JOIN_TAB *join_tab, uint keyno, Opt_trace_object *trace_obj)
 Try to extract and push the index condition down to table handler. More...
 
uint effective_index () const
 Return the index used for a table in a QEP. More...
 
bool pfs_batch_update (JOIN *join) const
 
 QEP_TAB (const QEP_TAB &)
 
QEP_TABoperator= (const QEP_TAB &)
 
- 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)
 
TABLE_REFref () 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)
 
QUICK_SELECT_Iquick () const
 
void set_quick (QUICK_SELECT_I *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_LISTtable_ref
 Pointer to table reference. More...
 
SJ_TMP_TABLEflush_weedout_table
 
SJ_TMP_TABLEcheck_weed_out_table
 
plan_idx firstmatch_return
 
uint loosescan_key_len
 
ucharloosescan_buf
 
plan_idx match_tab
 
bool found_match
 
bool found
 Used to decide whether an inner table of an outer join should produce NULL values. More...
 
bool not_null_compl
 This member is true as long as we are evaluating rows from the inner tables of an outer join. More...
 
plan_idx first_unmatched
 used for optimization purposes only
More...
 
bool rematerialize
 Dependent table functions have to be materialized on each new scan. More...
 
Setup_func materialize_table
 
bool using_dynamic_range = false
 
Next_select_func next_select
 
unique_ptr_destroy_only< RowIteratoriterator
 
bool used_null_fields
 
bool used_uneven_bit_fields
 
rowid_statuses rowid_status {NO_ROWID_NEEDED}
 
CACHE_FIELDcopy_current_rowid
 
bool needs_duplicate_removal = false
 true <=> remove duplicates on this table. More...
 
bool not_used_in_distinct
 
Itemcache_idx_cond
 Index condition for BKA access join. More...
 
Itemhaving
 HAVING condition for checking prior saving a record into tmp table. More...
 
QEP_operationop
 
Temp_table_paramtmp_table_param
 
Filesortfilesort
 
uint ref_item_slice
 Slice number of the ref items array to switch to before reading rows from this table. More...
 
ha_rows send_records
 Number of records saved in tmp table. More...
 
Itemm_condition_optim
 
QUICK_SELECT_Im_quick_optim
 m_quick is the quick "to be used at this stage of execution". More...
 
bool m_keyread_optim
 True if only index is going to be read for this table. More...
 
bool m_reversed_access
 True if reversed scan is used. More...
 
ha_rows m_fetched_rows
 Count of rows fetched from this table; maintained by sub_select() and reset to 0 by JOIN::reset(). More...
 
table_map lateral_derived_tables_depend_on_me
 Maps of all lateral derived tables which should be refreshed when execution reads a new row from this table. More...
 
Mem_root_array< const CacheInvalidatorIterator * > * invalidators = nullptr
 
bool m_temporary_table_deduplicates = false
 If this table is a temporary table used for whole-JOIN materialization (e.g. More...
 
bool m_using_table_scan = false
 True if iterator is a TableScanIterator. More...
 
FollowTailIteratorrecursive_iterator = nullptr
 If this table is a recursive reference(to a CTE), contains a pointer to the iterator here. More...
 

Additional Inherited Members

- Protected Attributes inherited from QEP_shared_owner
QEP_sharedm_qs
 

Member Typedef Documentation

◆ Setup_func

typedef int(* QEP_TAB::Setup_func) (QEP_TAB *)

Constructor & Destructor Documentation

◆ QEP_TAB() [1/2]

QEP_TAB::QEP_TAB ( )
inline

◆ QEP_TAB() [2/2]

QEP_TAB::QEP_TAB ( const QEP_TAB )

Member Function Documentation

◆ condition_optim()

Item* QEP_TAB::condition_optim ( ) const
inline

◆ do_firstmatch()

bool QEP_TAB::do_firstmatch ( ) const
inline

Return true if join_tab should perform a FirstMatch action.

◆ do_loosescan()

bool QEP_TAB::do_loosescan ( ) const
inline

Return true if join_tab should perform a LooseScan action.

◆ dynamic_range()

bool QEP_TAB::dynamic_range ( ) const
inline
Returns
whether this is doing QS_DYNAMIC_RANGE

◆ finishes_weedout()

bool QEP_TAB::finishes_weedout ( ) const
inline

Return true if join_tab finishes a Duplicate Weedout action.

◆ keyread_optim()

bool QEP_TAB::keyread_optim ( ) const
inline

◆ operator=()

QEP_TAB& QEP_TAB::operator= ( const QEP_TAB )

◆ quick_optim()

QUICK_SELECT_I* QEP_TAB::quick_optim ( ) const
inline

◆ restore_quick_optim_and_condition()

void QEP_TAB::restore_quick_optim_and_condition ( )
inline

Used to begin a new execution of a subquery.

Necessary if this subquery has done a filesort which which has cleared condition/quick.

◆ reversed_access()

bool QEP_TAB::reversed_access ( ) const
inline

◆ set_condition_optim()

void QEP_TAB::set_condition_optim ( )
inline

◆ set_keyread_optim()

void QEP_TAB::set_keyread_optim ( )
inline

◆ set_quick_optim()

void QEP_TAB::set_quick_optim ( )
inline

◆ set_reversed_access()

void QEP_TAB::set_reversed_access ( bool  arg)
inline

◆ set_table()

void QEP_TAB::set_table ( TABLE t)
inline

◆ set_temporary_table_deduplicates()

void QEP_TAB::set_temporary_table_deduplicates ( bool  arg)
inline

◆ set_using_table_scan()

void QEP_TAB::set_using_table_scan ( bool  arg)
inline

◆ starts_weedout()

bool QEP_TAB::starts_weedout ( ) const
inline

Return true if join_tab starts a Duplicate Weedout action.

◆ temporary_table_deduplicates()

bool QEP_TAB::temporary_table_deduplicates ( ) const
inline

◆ using_table_scan()

bool QEP_TAB::using_table_scan ( ) const
inline

Member Data Documentation

◆ cache_idx_cond

Item* QEP_TAB::cache_idx_cond

Index condition for BKA access join.

◆ check_weed_out_table

SJ_TMP_TABLE* QEP_TAB::check_weed_out_table

◆ copy_current_rowid

CACHE_FIELD* QEP_TAB::copy_current_rowid

◆ filesort

Filesort* QEP_TAB::filesort

◆ first_unmatched

plan_idx QEP_TAB::first_unmatched

used for optimization purposes only

◆ firstmatch_return

plan_idx QEP_TAB::firstmatch_return

◆ flush_weedout_table

SJ_TMP_TABLE* QEP_TAB::flush_weedout_table

◆ found

bool QEP_TAB::found

Used to decide whether an inner table of an outer join should produce NULL values.

If it is true after a call to evaluate_join_record(), the join condition has been satisfied for at least one row from the inner table. This member is not really manipulated by this class, see sub_select for details on its use.

◆ found_match

bool QEP_TAB::found_match

◆ having

Item* QEP_TAB::having

HAVING condition for checking prior saving a record into tmp table.

◆ invalidators

Mem_root_array<const CacheInvalidatorIterator *>* QEP_TAB::invalidators = nullptr

◆ iterator

◆ lateral_derived_tables_depend_on_me

table_map QEP_TAB::lateral_derived_tables_depend_on_me

Maps of all lateral derived tables which should be refreshed when execution reads a new row from this table.

Note
that if a LDT depends on t1 and t2, and t2 is after t1 in the plan, then only t2::lateral_derived_tables_depend_on_me gets the map of the LDT, for efficiency (less useless calls to QEP_TAB::refresh_lateral()) and clarity in EXPLAIN.

◆ loosescan_buf

uchar* QEP_TAB::loosescan_buf

◆ loosescan_key_len

uint QEP_TAB::loosescan_key_len

◆ m_condition_optim

Item* QEP_TAB::m_condition_optim
See also
m_quick_optim

◆ m_fetched_rows

ha_rows QEP_TAB::m_fetched_rows

Count of rows fetched from this table; maintained by sub_select() and reset to 0 by JOIN::reset().

Only used by the pre-iterator executor.

◆ m_keyread_optim

bool QEP_TAB::m_keyread_optim

True if only index is going to be read for this table.

This is the optimizer's decision.

◆ m_quick_optim

QUICK_SELECT_I* QEP_TAB::m_quick_optim

m_quick is the quick "to be used at this stage of execution".

It can happen that filesort uses the quick (produced by the optimizer) to produce a sorted result, then the read of this result has to be done without "quick", so we must reset m_quick to NULL, but we want to delay freeing of m_quick or it would close the filesort's result and the table prematurely. In that case, we move m_quick to m_quick_optim (=> delay deletion), reset m_quick to NULL (read of filesort's result will be without quick); if this is a subquery which is later executed a second time, QEP_TAB::reset() will restore the quick from m_quick_optim into m_quick. quick_optim stands for "the quick decided by the optimizer". EXPLAIN reads this member and m_condition_optim; so if you change them after exposing the plan (setting plan_state), do it with the LOCK_query_plan mutex.

◆ m_reversed_access

bool QEP_TAB::m_reversed_access

True if reversed scan is used.

This is the optimizer's decision.

◆ m_temporary_table_deduplicates

bool QEP_TAB::m_temporary_table_deduplicates = false

If this table is a temporary table used for whole-JOIN materialization (e.g.

before sorting): true iff the table deduplicates, typically by way of an unique index.

Otherwise, unused.

◆ m_using_table_scan

bool QEP_TAB::m_using_table_scan = false

True if iterator is a TableScanIterator.

Used so that we can know whether to stream directly across derived tables and into sorts (we cannot if there is a ref access).

◆ match_tab

plan_idx QEP_TAB::match_tab

◆ materialize_table

Setup_func QEP_TAB::materialize_table

◆ needs_duplicate_removal

bool QEP_TAB::needs_duplicate_removal = false

true <=> remove duplicates on this table.

◆ next_select

Next_select_func QEP_TAB::next_select

◆ not_null_compl

bool QEP_TAB::not_null_compl

This member is true as long as we are evaluating rows from the inner tables of an outer join.

If none of these rows satisfy the join condition, we generated NULL-complemented rows and set this member to false. In the meantime, the value may be read by triggered conditions, see Item_func_trig_cond::val_int().

◆ not_used_in_distinct

bool QEP_TAB::not_used_in_distinct

◆ op

QEP_operation* QEP_TAB::op

◆ recursive_iterator

FollowTailIterator* QEP_TAB::recursive_iterator = nullptr

If this table is a recursive reference(to a CTE), contains a pointer to the iterator here.

This is so that MaterializeIterator can get a list of all such iterators, to coordinate rematerialization and other signals.

◆ ref_item_slice

uint QEP_TAB::ref_item_slice

Slice number of the ref items array to switch to before reading rows from this table.

◆ rematerialize

bool QEP_TAB::rematerialize

Dependent table functions have to be materialized on each new scan.

◆ rowid_status

rowid_statuses QEP_TAB::rowid_status {NO_ROWID_NEEDED}

◆ send_records

ha_rows QEP_TAB::send_records

Number of records saved in tmp table.

◆ table_ref

TABLE_LIST* QEP_TAB::table_ref

Pointer to table reference.

◆ tmp_table_param

Temp_table_param* QEP_TAB::tmp_table_param

◆ used_null_fields

bool QEP_TAB::used_null_fields

◆ used_uneven_bit_fields

bool QEP_TAB::used_uneven_bit_fields

◆ using_dynamic_range

bool QEP_TAB::using_dynamic_range = false

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