MySQL  8.0.21
Source Code Documentation
records.cc File Reference

Implementations of basic iterators, ie. More...

#include "sql/records.h"
#include <string.h>
#include <algorithm>
#include <atomic>
#include <new>
#include "my_base.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/key.h"
#include "sql/opt_explain.h"
#include "sql/opt_range.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_executor.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_sort.h"
#include "sql/sql_tmp_table.h"
#include "sql/table.h"
#include "sql/timing_iterator.h"

Functions

unique_ptr_destroy_only< RowIteratorcreate_table_iterator_idx (THD *thd, TABLE *table, uint idx, bool reverse, QEP_TAB *qep_tab)
 Initialize a row iterator to perform full index scan in desired direction using the RowIterator interface. More...
 
unique_ptr_destroy_only< RowIteratorcreate_table_iterator (THD *thd, TABLE *table, QEP_TAB *qep_tab, bool disable_rr_cache, bool ignore_not_found_rows, ha_rows *examined_rows, bool *using_table_scan)
 setup_read_record is used to scan by using a number of different methods. More...
 
unique_ptr_destroy_only< RowIteratorinit_table_iterator (THD *thd, TABLE *table, QEP_TAB *qep_tab, bool disable_rr_cache, bool ignore_not_found_rows)
 Calls create_table_iterator(), then calls Init() on the resulting iterator. More...
 

Detailed Description

Implementations of basic iterators, ie.

those that have no children and don't take any refs (they typically read directly from a table in some way). See row_iterator.h.

Function Documentation

◆ create_table_iterator()

unique_ptr_destroy_only<RowIterator> create_table_iterator ( THD thd,
TABLE table,
QEP_TAB qep_tab,
bool  disable_rr_cache,
bool  ignore_not_found_rows,
ha_rows examined_rows,
bool using_table_scan 
)

setup_read_record is used to scan by using a number of different methods.

Which method to use is set-up in this call so that you can fetch rows through the resulting row iterator afterwards.

Parameters
thdThread handle
tableTable the data [originally] comes from; if NULL, 'table' is inferred from 'qep_tab'; if non-NULL, 'qep_tab' must be NULL.
qep_tabQEP_TAB for 'table', if there is one; we may use qep_tab->quick() as data source
disable_rr_cacheDon't use caching in SortBufferIndirectIterator (used by sort-union index-merge which produces rowid sequences that are already ordered)
ignore_not_found_rowsIgnore any rows not found in reference tables, as they may already have been deleted by foreign key handling. Only relevant for methods that need to look up rows in tables (those marked “Indirect”).
examined_rowsIf non-nullptr, the iterator will increase this variable by the number of examined rows. If nullptr, will use qep_tab->join()->examined_rows if possible.
using_table_scanIf non-nullptr, will be whether a TableScanIterator was chosen.

◆ create_table_iterator_idx()

unique_ptr_destroy_only<RowIterator> create_table_iterator_idx ( THD thd,
TABLE table,
uint  idx,
bool  reverse,
QEP_TAB qep_tab 
)

Initialize a row iterator to perform full index scan in desired direction using the RowIterator interface.

This function has been added at late stage and is used only by UPDATE/DELETE. Other statements perform index scans using IndexScanIterator.

Parameters
thdThread handle
tableTable to be accessed
idxindex to scan
reverseScan in the reverse direction
qep_tabIf not NULL, used for record buffer and pushed condition
Return values
trueerror
falsesuccess

◆ init_table_iterator()

unique_ptr_destroy_only<RowIterator> init_table_iterator ( THD thd,
TABLE table,
QEP_TAB qep_tab,
bool  disable_rr_cache,
bool  ignore_not_found_rows 
)

Calls create_table_iterator(), then calls Init() on the resulting iterator.

Returns nullptr on failure.