24#ifndef SQL_JOIN_OPTIMIZER_ACCESS_PATH_H
25#define SQL_JOIN_OPTIMIZER_ACCESS_PATH_H
520 return u.ref_or_null;
524 return u.ref_or_null;
536 return u.pushed_join_ref;
540 return u.pushed_join_ref;
544 return u.full_text_search;
548 return u.full_text_search;
552 return u.const_table;
556 return u.const_table;
568 return u.follow_tail;
572 return u.follow_tail;
576 return u.index_range_scan;
580 return u.index_range_scan;
584 return u.index_merge;
588 return u.index_merge;
592 return u.rowid_intersection;
596 return u.rowid_intersection;
600 return u.rowid_union;
604 return u.rowid_union;
608 return u.index_skip_scan;
612 return u.index_skip_scan;
616 return u.group_index_skip_scan;
620 return u.group_index_skip_scan;
624 return u.dynamic_index_range_scan;
628 return u.dynamic_index_range_scan;
632 return u.materialized_table_function;
636 return u.materialized_table_function;
640 return u.unqualified_count;
644 return u.unqualified_count;
648 return u.table_value_constructor;
652 return u.table_value_constructor;
656 return u.fake_single_row;
660 return u.fake_single_row;
672 return u.zero_rows_aggregated;
676 return u.zero_rows_aggregated;
696 return u.nested_loop_join;
700 return u.nested_loop_join;
704 return u.nested_loop_semijoin_with_duplicate_removal;
708 return u.nested_loop_semijoin_with_duplicate_removal;
736 return u.temptable_aggregate;
740 return u.temptable_aggregate;
744 return u.limit_offset;
748 return u.limit_offset;
760 return u.materialize;
764 return u.materialize;
768 return u.materialize_information_schema_table;
772 return u.materialize_information_schema_table;
800 return u.remove_duplicates;
804 return u.remove_duplicates;
808 return u.remove_duplicates_on_index;
812 return u.remove_duplicates_on_index;
816 return u.alternative;
820 return u.alternative;
824 return u.cache_invalidator;
828 return u.cache_invalidator;
832 return u.delete_rows;
836 return u.delete_rows;
840 return u.update_rows;
844 return u.update_rows;
1217static_assert(std::is_trivially_destructible<AccessPath>::value,
1218 "AccessPath must be trivially destructible, as it is allocated "
1219 "on the MEM_ROOT and not wrapped in unique_ptr_destroy_only"
1220 "(because multiple candidates during planning could point to "
1221 "the same access paths, and refcounting would be expensive)");
1223 "We are creating a lot of access paths in the join "
1224 "optimizer, so be sure not to bloat it without noticing. "
1225 "(96 bytes for the base, 48 bytes for the variant.)");
1240 bool count_examined_rows) {
1243 path->count_examined_rows = count_examined_rows;
1244 path->table_scan().table = table;
1250 bool count_examined_rows) {
1253 path->count_examined_rows = count_examined_rows;
1254 path->index_scan().table = table;
1255 path->index_scan().idx = idx;
1256 path->index_scan().use_order = use_order;
1263 bool count_examined_rows) {
1266 path->count_examined_rows = count_examined_rows;
1267 path->ref().table = table;
1269 path->ref().use_order = use_order;
1276 bool count_examined_rows) {
1279 path->count_examined_rows = count_examined_rows;
1280 path->ref_or_null().table = table;
1281 path->ref_or_null().ref =
ref;
1282 path->ref_or_null().use_order = use_order;
1287 bool count_examined_rows) {
1290 path->count_examined_rows = count_examined_rows;
1291 path->eq_ref().table = table;
1299 bool count_examined_rows) {
1302 path->count_examined_rows = count_examined_rows;
1303 path->pushed_join_ref().table = table;
1304 path->pushed_join_ref().ref =
ref;
1305 path->pushed_join_ref().use_order = use_order;
1306 path->pushed_join_ref().is_unique = is_unique;
1313 bool use_order,
bool use_limit,
1314 bool count_examined_rows) {
1317 path->count_examined_rows = count_examined_rows;
1318 path->full_text_search().table = table;
1319 path->full_text_search().ref =
ref;
1320 path->full_text_search().use_order = use_order;
1321 path->full_text_search().use_limit = use_limit;
1322 path->full_text_search().ft_func = ft_func;
1328 bool count_examined_rows) {
1331 path->count_examined_rows = count_examined_rows;
1332 path->set_num_output_rows(1.0);
1334 path->init_cost = 0.0;
1335 path->init_once_cost = 0.0;
1336 path->const_table().table = table;
1337 path->const_table().ref =
ref;
1345 path->mrr().table = table;
1347 path->mrr().mrr_flags = mrr_flags;
1350 path->mrr().bka_path =
nullptr;
1356 bool count_examined_rows) {
1359 path->count_examined_rows = count_examined_rows;
1360 path->follow_tail().table = table;
1368 path->count_examined_rows = count_examined_rows;
1369 path->dynamic_index_range_scan().table = table;
1370 path->dynamic_index_range_scan().qep_tab = qep_tab;
1379 path->materialized_table_function().table = table;
1380 path->materialized_table_function().table_function = table_function;
1381 path->materialized_table_function().table_path = table_path;
1396 path->count_examined_rows =
true;
1402 KEY *
key,
size_t key_len) {
1405 path->nested_loop_semijoin_with_duplicate_removal().outer = outer;
1406 path->nested_loop_semijoin_with_duplicate_removal().inner = inner;
1407 path->nested_loop_semijoin_with_duplicate_removal().table = table;
1408 path->nested_loop_semijoin_with_duplicate_removal().key =
key;
1409 path->nested_loop_semijoin_with_duplicate_removal().key_len = key_len;
1417 path->filter().child = child;
1418 path->filter().condition = condition;
1419 path->filter().materialize_subqueries =
false;
1426 ORDER *order,
bool count_examined_rows);
1432 path->aggregate().child = child;
1433 path->aggregate().rollup = rollup;
1442 path->temptable_aggregate().subquery_path = subquery_path;
1443 path->temptable_aggregate().temp_table_param = temp_table_param;
1444 path->temptable_aggregate().table = table;
1445 path->temptable_aggregate().table_path = table_path;
1446 path->temptable_aggregate().ref_slice = ref_slice;
1452 bool count_all_rows,
1453 bool reject_multiple_rows,
1454 ha_rows *send_records_override) {
1458 path->immediate_update_delete_table = child->immediate_update_delete_table;
1459 path->limit_offset().child = child;
1460 path->limit_offset().limit = limit;
1461 path->limit_offset().offset = offset;
1462 path->limit_offset().count_all_rows = count_all_rows;
1463 path->limit_offset().reject_multiple_rows = reject_multiple_rows;
1464 path->limit_offset().send_records_override = send_records_override;
1465 path->ordering_state = child->ordering_state;
1471 bool count_examined_rows) {
1474 path->count_examined_rows = count_examined_rows;
1475 path->set_num_output_rows(1.0);
1477 path->init_cost = 0.0;
1478 path->init_once_cost = 0.0;
1483 const char *cause) {
1486 path->zero_rows().child = child;
1487 path->zero_rows().cause = cause;
1488 path->set_num_output_rows(0.0);
1490 path->init_cost = 0.0;
1491 path->init_once_cost = 0.0;
1492 path->num_output_rows_before_filter = 0.0;
1493 path->cost_before_filter = 0.0;
1502 const char *cause) {
1505 path->zero_rows_aggregated().cause = cause;
1506 path->set_num_output_rows(1.0);
1508 path->init_cost = 0.0;
1515 TABLE *table,
int ref_slice) {
1518 path->stream().child = child;
1520 path->stream().temp_table_param = temp_table_param;
1521 path->stream().table = table;
1522 path->stream().ref_slice = ref_slice;
1524 path->stream().provide_rowid =
false;
1532 assert(
path !=
nullptr);
1549 int ref_slice,
bool rematerialize,
ha_rows limit_rows,
1550 bool reject_multiple_rows) {
1554 if (rematerialize) {
1561 param->
table = table;
1583 path->materialize().table_path = table_path;
1584 path->materialize().param = param;
1585 path->materialize().subquery_cost = -1.0;
1586 if (rematerialize) {
1599 path->materialize_information_schema_table().table_path = table_path;
1600 path->materialize_information_schema_table().table_list = table_list;
1601 path->materialize_information_schema_table().condition = condition;
1611 path->append().children = children;
1613 path->init_cost = 0.0;
1614 path->init_once_cost = 0.0;
1615 double num_output_rows = 0.0;
1617 path->cost += child.path->cost;
1618 path->init_cost += child.path->init_cost;
1619 path->init_once_cost += child.path->init_once_cost;
1620 num_output_rows += child.path->num_output_rows();
1622 path->set_num_output_rows(num_output_rows);
1629 int ref_slice,
bool needs_buffering) {
1632 path->window().child = child;
1633 path->window().window = window;
1634 path->window().temp_table =
nullptr;
1635 path->window().temp_table_param = temp_table_param;
1636 path->window().ref_slice = ref_slice;
1637 path->window().needs_buffering = needs_buffering;
1645 path->weedout().child = child;
1646 path->weedout().weedout_table = weedout_table;
1647 path->weedout().tables_to_get_rowid_for =
1654 int group_items_size) {
1657 path->remove_duplicates().child = child;
1658 path->remove_duplicates().group_items = group_items;
1659 path->remove_duplicates().group_items_size = group_items_size;
1665 unsigned loosescan_key_len) {
1668 path->remove_duplicates_on_index().child = child;
1669 path->remove_duplicates_on_index().table = table;
1670 path->remove_duplicates_on_index().key =
key;
1671 path->remove_duplicates_on_index().loosescan_key_len = loosescan_key_len;
1680 path->alternative().table_scan_path = table_scan_path;
1681 path->alternative().child = child;
1682 path->alternative().used_ref = used_ref;
1690 path->cache_invalidator().child = child;
1691 path->cache_invalidator().name =
name;
1724 bool eligible_for_batch_mode);
1732 eligible_for_batch_mode);
1736 const POSITION *pos,
bool is_after_filter,
1783 unsigned num_where_predicates);
1791 int num_where_predicates);
1797 unsigned num_where_predicates);
AccessPath * NewStreamingAccessPath(THD *thd, AccessPath *child, JOIN *join, Temp_table_param *temp_table_param, TABLE *table, int ref_slice)
Definition: access_path.h:1512
AccessPath * NewRemoveDuplicatesAccessPath(THD *thd, AccessPath *child, Item **group_items, int group_items_size)
Definition: access_path.h:1652
AccessPath * NewInvalidatorAccessPath(THD *thd, AccessPath *child, const char *name)
Definition: access_path.h:1686
AccessPath * NewRefAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool use_order, bool reverse, bool count_examined_rows)
Definition: access_path.h:1261
AccessPath * NewDeleteRowsAccessPath(THD *thd, AccessPath *child, table_map delete_tables, table_map immediate_tables)
Definition: access_path.cc:101
bool FinalizeMaterializedSubqueries(THD *thd, JOIN *join, AccessPath *path)
If the path is a FILTER path marked that subqueries are to be materialized, do so.
Definition: access_path.cc:308
void CopyBasicProperties(const AccessPath &from, AccessPath *to)
Definition: access_path.h:1227
void ExpandSingleFilterAccessPath(THD *thd, AccessPath *path, const JOIN *join, const Mem_root_array< Predicate > &predicates, unsigned num_where_predicates)
Like ExpandFilterAccessPaths(), but expands only the single access path at “path”.
Definition: access_path.cc:1352
AccessPath * NewFullTextSearchAccessPath(THD *thd, TABLE *table, Index_lookup *ref, Item_func_match *ft_func, bool use_order, bool use_limit, bool count_examined_rows)
Definition: access_path.h:1310
AccessPath * NewTemptableAggregateAccessPath(THD *thd, AccessPath *subquery_path, Temp_table_param *temp_table_param, TABLE *table, AccessPath *table_path, int ref_slice)
Definition: access_path.h:1437
table_map GetHashJoinTables(AccessPath *path)
Returns the tables that are part of a hash join.
Definition: access_path.cc:1474
AccessPath * NewDynamicIndexRangeScanAccessPath(THD *thd, TABLE *table, QEP_TAB *qep_tab, bool count_examined_rows)
Definition: access_path.h:1364
AccessPath * NewZeroRowsAggregatedAccessPath(THD *thd, const char *cause)
Definition: access_path.h:1501
AccessPath * NewAlternativeAccessPath(THD *thd, AccessPath *child, AccessPath *table_scan_path, Index_lookup *used_ref)
Definition: access_path.h:1675
AccessPath * NewUpdateRowsAccessPath(THD *thd, AccessPath *child, table_map delete_tables, table_map immediate_tables)
Definition: access_path.cc:113
AccessPath * NewMRRAccessPath(THD *thd, TABLE *table, Index_lookup *ref, int mrr_flags)
Definition: access_path.h:1341
table_map GetUsedTableMap(const AccessPath *path, bool include_pruned_tables)
Returns a map of all tables read when path or any of its children are executed.
Definition: access_path.cc:215
AccessPath * NewAppendAccessPath(THD *thd, Mem_root_array< AppendPathParameters > *children)
Definition: access_path.h:1607
AccessPath * NewNestedLoopSemiJoinWithDuplicateRemovalAccessPath(THD *thd, AccessPath *outer, AccessPath *inner, const TABLE *table, KEY *key, size_t key_len)
Definition: access_path.h:1400
AccessPath * NewRemoveDuplicatesOnIndexAccessPath(THD *thd, AccessPath *child, TABLE *table, KEY *key, unsigned loosescan_key_len)
Definition: access_path.h:1663
AccessPath * NewFakeSingleRowAccessPath(THD *thd, bool count_examined_rows)
Definition: access_path.h:1470
Item * ConditionFromFilterPredicates(const Mem_root_array< Predicate > &predicates, OverflowBitset mask, int num_where_predicates)
Extracts the Item expression from the given “filter_predicates” corresponding to the given “mask”.
Definition: access_path.cc:1341
AccessPath * NewFilterAccessPath(THD *thd, AccessPath *child, Item *condition)
Definition: access_path.h:1413
constexpr double kUnknownRowCount
To indicate that a row estimate is not yet made.
Definition: access_path.h:169
AccessPath * NewSortAccessPath(THD *thd, AccessPath *child, Filesort *filesort, ORDER *order, bool count_examined_rows)
Definition: access_path.cc:66
AccessPath * NewMaterializedTableFunctionAccessPath(THD *thd, TABLE *table, Table_function *table_function, AccessPath *table_path)
Definition: access_path.h:1374
AccessPath * NewMaterializeAccessPath(THD *thd, Mem_root_array< MaterializePathParameters::QueryBlock > query_blocks, Mem_root_array< const AccessPath * > *invalidators, TABLE *table, AccessPath *table_path, Common_table_expr *cte, Query_expression *unit, int ref_slice, bool rematerialize, ha_rows limit_rows, bool reject_multiple_rows)
Definition: access_path.h:1544
Mem_root_array< TABLE * > CollectTables(THD *thd, AccessPath *root_path)
Find the list of all tables used by this root, stopping at materializations.
Definition: access_path.cc:246
AccessPath * NewTableScanAccessPath(THD *thd, TABLE *table, bool count_examined_rows)
Definition: access_path.h:1239
void ExpandFilterAccessPaths(THD *thd, AccessPath *path, const JOIN *join, const Mem_root_array< Predicate > &predicates, unsigned num_where_predicates)
For each access path in the (sub)tree rooted at “path”, expand any use of “filter_predicates” into ne...
Definition: access_path.cc:1462
AccessPath * NewMaterializeInformationSchemaTableAccessPath(THD *thd, AccessPath *table_path, Table_ref *table_list, Item *condition)
Definition: access_path.h:1595
void FindTablesToGetRowidFor(AccessPath *path)
Modifies "path" and the paths below it so that they provide row IDs for all tables.
Definition: access_path.cc:1197
Mem_root_array< MaterializePathParameters::QueryBlock > SingleMaterializeQueryBlock(THD *thd, AccessPath *path, int select_number, JOIN *join, bool copy_items, Temp_table_param *temp_table_param)
Definition: access_path.h:1529
AccessPath * NewAggregateAccessPath(THD *thd, AccessPath *child, bool rollup)
Definition: access_path.h:1428
TABLE * GetBasicTable(const AccessPath *path)
Return the TABLE* referred from 'path' if it is a basic access path, else a nullptr is returned.
Definition: access_path.cc:162
AccessPath * NewRefOrNullAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool use_order, bool count_examined_rows)
Definition: access_path.h:1274
AccessPath * NewLimitOffsetAccessPath(THD *thd, AccessPath *child, ha_rows limit, ha_rows offset, bool count_all_rows, bool reject_multiple_rows, ha_rows *send_records_override)
Definition: access_path.h:1450
AccessPath * NewEQRefAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool count_examined_rows)
Definition: access_path.h:1286
AccessPath * NewWindowAccessPath(THD *thd, AccessPath *child, Window *window, Temp_table_param *temp_table_param, int ref_slice, bool needs_buffering)
Definition: access_path.h:1626
AccessPath * NewFollowTailAccessPath(THD *thd, TABLE *table, bool count_examined_rows)
Definition: access_path.h:1355
AccessPath * NewTableValueConstructorAccessPath(THD *thd)
Definition: access_path.h:1391
AccessPath * NewConstTableAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool count_examined_rows)
Definition: access_path.h:1326
unique_ptr_destroy_only< RowIterator > CreateIteratorFromAccessPath(THD *thd, MEM_ROOT *mem_root, AccessPath *path, JOIN *join, bool eligible_for_batch_mode)
Definition: access_path.cc:378
AccessPath * NewWeedoutAccessPath(THD *thd, AccessPath *child, SJ_TMP_TABLE *weedout_table)
Definition: access_path.h:1641
AccessPath * NewPushedJoinRefAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool use_order, bool is_unique, bool count_examined_rows)
Definition: access_path.h:1296
AccessPath * NewZeroRowsAccessPath(THD *thd, AccessPath *child, const char *cause)
Definition: access_path.h:1482
AccessPath * NewUnqualifiedCountAccessPath(THD *thd)
Definition: access_path.h:1385
AccessPath * NewIndexScanAccessPath(THD *thd, TABLE *table, int idx, bool use_order, bool reverse, bool count_examined_rows)
Definition: access_path.h:1248
A wrapper class which provides array bounds checking.
Definition: sql_array.h:47
After parsing, a Common Table Expression is accessed through a Table_ref.
Definition: table.h:4329
API for getting cost estimates for server operations that are not directly related to a table object.
Definition: opt_costmodel.h:52
Sorting related info.
Definition: filesort.h:52
Definition: item_func.h:3396
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
Definition: sql_optimizer.h:133
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Definition: overflow_bitset.h:77
Definition: sql_executor.h:260
Definition: range_optimizer.h:69
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:623
A context for reading through a single table using a chosen access method: index read,...
Definition: row_iterator.h:82
Definition: sql_executor.h:104
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
MEM_ROOT * mem_root
Definition: sql_lexer_thd.h:38
Class representing a table function.
Definition: table_function.h:53
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:95
Represents the (explicit) window of a SQL 2003 section 7.11 <window clause>, or the implicit (inlined...
Definition: window.h:105
static MEM_ROOT mem_root
Definition: client_plugin.cc:110
void EstimateLimitOffsetCost(AccessPath *path)
Estimate the costs and row count for a LIMIT_OFFSET AccessPath.
Definition: cost_model.cc:887
bool filesort(THD *thd, Filesort *filesort, RowIterator *source_iterator, table_map tables_to_get_rowid_for, ha_rows num_rows_estimate, Filesort_info *fs_info, Sort_result *sort_result, ha_rows *found_rows)
Sort a table.
Definition: filesort.cc:367
void SetCostOnTableAccessPath(const Cost_model_server &cost_model, const POSITION *pos, bool is_after_filter, AccessPath *path)
Definition: sql_executor.cc:1913
std::bitset< kMaxSupportedFDs > FunctionalDependencySet
Definition: interesting_orders_defs.h:63
JoinType
Definition: join_type.h:28
static mi_bit_type mask[]
Definition: mi_packrec.cc:141
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:489
my_off_t ha_rows
Definition: my_base.h:1140
#define HA_POS_ERROR
Definition: my_base.h:1142
uint64_t table_map
Definition: my_table_map.h:30
static char * path
Definition: mysqldump.cc:137
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
uint64_t NodeMap
Since our graphs can never have more than 61 tables, node sets and edge lists are implemented using 6...
Definition: node_map.h:40
RangeReverse< Range > reverse(Range &x)
Iterate over a range in reverse.
Definition: utilities.h:132
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:151
int delete_tables(PFS_engine_table_share_proxy **, unsigned int) noexcept
Definition: pfs_plugin_table_v1_all_empty.cc:39
OverflowBitset is a fixed-size (once allocated) bitmap that is optimized for the common case of few e...
required string key
Definition: replication_asynchronous_connection_failover.proto:60
case opt name
Definition: sslopt-case.h:33
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:193
struct AccessPath::@56::@92 append
struct AccessPath::@56::@76 table_value_constructor
auto & weedout()
Definition: access_path.h:790
struct AccessPath::@56::@83 nested_loop_semijoin_with_duplicate_removal
auto & filter()
Definition: access_path.h:710
bool count_all_rows
Definition: access_path.h:1136
AccessPath * bka_path
Definition: access_path.h:906
struct AccessPath::@56::@75 unqualified_count
struct AccessPath::@56::@68 index_merge
auto & ref_or_null()
Definition: access_path.h:518
auto & materialized_table_function()
Definition: access_path.h:630
AccessPath * cpk_child
Definition: access_path.h:967
auto & rowid_union()
Definition: access_path.h:598
double cost_before_filter
Definition: access_path.h:396
hypergraph::NodeMap parameter_tables
If nonzero, a bitmap of other tables whose joined-in rows must already be loaded when rows from this ...
Definition: access_path.h:482
const auto & bka_join() const
Definition: access_path.h:690
TABLE * temp_table
Definition: access_path.h:1173
OverflowBitset equijoin_predicates
Definition: access_path.h:1077
Item ** group_items
Definition: access_path.h:1185
struct AccessPath::@56::@62 pushed_join_ref
double rescan_cost() const
Return the cost of scanning the given path for the second time (or later) in the given query block.
Definition: access_path.h:391
bool rollup
Definition: access_path.h:1123
auto & materialize()
Definition: access_path.h:758
const auto & temptable_aggregate() const
Definition: access_path.h:738
OverflowBitset & subsumed_sargable_join_predicates()
Similar to applied_sargable_join_predicates, bitmap of sargable join predicates that have been applie...
Definition: access_path.h:454
auto & index_scan()
Definition: access_path.h:502
const auto & delete_rows() const
Definition: access_path.h:834
const auto & filter() const
Definition: access_path.h:714
auto & delete_rows()
Definition: access_path.h:830
bool reuse_handler
Definition: access_path.h:944
struct AccessPath::@56::@86 aggregate
KEY_PART * used_key_part
Definition: access_path.h:918
OverflowBitset & applied_sargable_join_predicates()
Bitmap of sargable join predicates that have already been applied in this access path by means of an ...
Definition: access_path.h:434
Item * condition
Definition: access_path.h:1095
const auto & index_merge() const
Definition: access_path.h:586
const auto & update_rows() const
Definition: access_path.h:842
enum AccessPath::Type type
auto & alternative()
Definition: access_path.h:814
struct AccessPath::@56::@84 filter
auto & pushed_join_ref()
Definition: access_path.h:534
AccessPath * outer
Definition: access_path.h:1051
auto & index_skip_scan()
Definition: access_path.h:606
bool rewrite_semi_to_inner
Definition: access_path.h:1055
const auto & zero_rows_aggregated() const
Definition: access_path.h:674
auto & group_index_skip_scan()
Definition: access_path.h:614
struct AccessPath::@56::@80 hash_join
struct AccessPath::@56::@82 nested_loop_join
const auto & eq_ref() const
Definition: access_path.h:530
int group_items_size
Definition: access_path.h:1186
bool use_order
Definition: access_path.h:868
bool pfs_batch_mode
Definition: access_path.h:1069
auto & temptable_aggregate()
Definition: access_path.h:734
AccessPath()
Definition: access_path.h:199
GroupIndexSkipScanParameters * param
Definition: access_path.h:1011
auto & rowid_intersection()
Definition: access_path.h:590
bool materialize_subqueries
Definition: access_path.h:1105
AccessPath * child
Definition: access_path.h:1039
bool allow_spill_to_disk
Definition: access_path.h:1053
Index_lookup * used_ref
Definition: access_path.h:1199
auto & mrr()
Definition: access_path.h:558
const auto & index_scan() const
Definition: access_path.h:506
const auto & fake_single_row() const
Definition: access_path.h:658
bool reject_multiple_rows
Definition: access_path.h:1137
bool allow_clustered_primary_key_scan
Definition: access_path.h:959
const char * name
Definition: access_path.h:1203
bool use_limit
Definition: access_path.h:896
Window * window
Definition: access_path.h:1172
table_map tables_to_get_rowid_for
Definition: access_path.h:1056
auto & materialize_information_schema_table()
Definition: access_path.h:766
auto & bka_join()
Definition: access_path.h:686
const auto & follow_tail() const
Definition: access_path.h:570
SJ_TMP_TABLE * weedout_table
Definition: access_path.h:1180
Index_lookup * ref
Definition: access_path.h:873
const auto & window() const
Definition: access_path.h:786
const auto & materialized_table_function() const
Definition: access_path.h:634
auto & unqualified_count()
Definition: access_path.h:638
bool keep_current_rowid
Definition: access_path.h:908
struct AccessPath::@56::@79 zero_rows_aggregated
bool using_extended_key_parts
Definition: access_path.h:954
struct AccessPath::@56::@99 delete_rows
auto & nested_loop_join()
Definition: access_path.h:694
const auto & full_text_search() const
Definition: access_path.h:546
struct AccessPath::@56::@65 mrr
bool can_be_used_for_ror
Definition: access_path.h:934
float rec_per_key
Definition: access_path.h:1062
struct AccessPath::@56::@100 update_rows
Safety safe_for_rowid
Whether it is safe to get row IDs (for sorting) from this access path.
Definition: access_path.h:292
JOIN * join
Definition: access_path.h:1144
unsigned index
Definition: access_path.h:930
unsigned mrr_buf_size
Definition: access_path.h:926
struct AccessPath::@56::@74 materialized_table_function
auto & remove_duplicates()
Definition: access_path.h:798
struct AccessPath::@56::@85 sort
RowIterator * iterator
If an iterator has been instantiated for this access path, points to the iterator.
Definition: access_path.h:359
const auto & stream() const
Definition: access_path.h:754
double init_cost
Expected cost to initialize this access path; ie., cost to read k out of N rows would be init_cost + ...
Definition: access_path.h:371
struct AccessPath::@56::@66 follow_tail
const auto & remove_duplicates() const
Definition: access_path.h:802
auto & window()
Definition: access_path.h:782
bool need_rows_in_rowid_order
Definition: access_path.h:938
Table_ref * table_list
Definition: access_path.h:1164
const auto & unqualified_count() const
Definition: access_path.h:642
void * secondary_engine_data
Auxiliary data used by a secondary storage engine while processing the access path during optimizatio...
Definition: access_path.h:491
struct AccessPath::@56::@78 zero_rows
void set_num_output_rows(double val)
Definition: access_path.h:849
bool is_covering
Definition: access_path.h:987
const auto & mrr() const
Definition: access_path.h:562
bool remove_duplicates
Definition: access_path.h:1117
table_map tables_to_update
Definition: access_path.h:1212
const auto & table_value_constructor() const
Definition: access_path.h:650
KEY * key
Definition: access_path.h:1089
struct AccessPath::@56::@57 table_scan
auto & table_value_constructor()
Definition: access_path.h:646
auto & stream()
Definition: access_path.h:750
size_t key_len
Definition: access_path.h:1090
const OverflowBitset & subsumed_sargable_join_predicates() const
Definition: access_path.h:457
const auto & zero_rows() const
Definition: access_path.h:666
const auto & append() const
Definition: access_path.h:778
ha_rows offset
Definition: access_path.h:1135
int idx
Definition: access_path.h:867
auto & hash_join()
Definition: access_path.h:678
auto & cache_invalidator()
Definition: access_path.h:822
bool force_sort_rowids
Definition: access_path.h:1119
unsigned num_used_key_parts
Definition: access_path.h:931
unsigned num_ranges
Definition: access_path.h:923
ORDER * order
Definition: access_path.h:1115
auto & sort()
Definition: access_path.h:718
auto & fake_single_row()
Definition: access_path.h:654
ha_rows limit
Definition: access_path.h:1116
struct AccessPath::@56::@73 dynamic_index_range_scan
struct AccessPath::@56::@67 index_range_scan
auto & follow_tail()
Definition: access_path.h:566
double m_num_output_rows
Expected number of output rows, -1.0 for unknown.
Definition: access_path.h:853
const JoinPredicate * join_predicate
Definition: access_path.h:1052
const auto & const_table() const
Definition: access_path.h:554
const auto & dynamic_index_range_scan() const
Definition: access_path.h:626
const auto & table_scan() const
Definition: access_path.h:498
unsigned mrr_flags
Definition: access_path.h:925
int ref_slice
Definition: access_path.h:1130
struct AccessPath::@56::@60 ref_or_null
struct AccessPath::@56::@96 remove_duplicates_on_index
OverflowBitset filter_predicates
Bitmap of WHERE predicates that we are including on this access path, referring to the “predicates” a...
Definition: access_path.h:418
bool can_be_used_for_imerge
Definition: access_path.h:941
bool forced_by_hint
Definition: access_path.h:958
auto & limit_offset()
Definition: access_path.h:742
AccessPath * inner
Definition: access_path.h:1051
bool provide_rowid
Definition: access_path.h:1147
struct AccessPath::@56::@81 bka_join
const auto & index_range_scan() const
Definition: access_path.h:578
const auto & ref() const
Definition: access_path.h:514
bool forced_by_dbug
Whether this access path is forced preferred over all others by means of a SET DEBUG force_subplan_0x...
Definition: access_path.h:303
Item_func_match * ft_func
Definition: access_path.h:897
struct AccessPath::@56::@58 index_scan
ha_rows * send_records_override
Definition: access_path.h:1140
auto & table_scan()
Definition: access_path.h:494
const auto & hash_join() const
Definition: access_path.h:682
QEP_TAB * qep_tab
Definition: access_path.h:1015
Table_function * table_function
Definition: access_path.h:1019
auto & zero_rows_aggregated()
Definition: access_path.h:670
const auto & sort() const
Definition: access_path.h:722
bool unwrap_rollup
Definition: access_path.h:1118
double init_once_cost
Of init_cost, how much of the initialization needs only to be done once per query block.
Definition: access_path.h:383
struct AccessPath::@56::@77 fake_single_row
Type
Definition: access_path.h:208
@ FOLLOW_TAIL
Definition: access_path.h:221
@ FILTER
Definition: access_path.h:245
@ PUSHED_JOIN_REF
Definition: access_path.h:217
@ ZERO_ROWS_AGGREGATED
Definition: access_path.h:234
@ UPDATE_ROWS
Definition: access_path.h:263
@ AGGREGATE
Definition: access_path.h:247
@ BKA_JOIN
Definition: access_path.h:241
@ ZERO_ROWS
Definition: access_path.h:233
@ CONST_TABLE
Definition: access_path.h:219
@ GROUP_INDEX_SKIP_SCAN
Definition: access_path.h:227
@ INDEX_RANGE_SCAN
Definition: access_path.h:222
@ UNQUALIFIED_COUNT
Definition: access_path.h:236
@ EQ_REF
Definition: access_path.h:216
@ FAKE_SINGLE_ROW
Definition: access_path.h:232
@ MATERIALIZE_INFORMATION_SCHEMA_TABLE
Definition: access_path.h:252
@ WINDOW
Definition: access_path.h:254
@ REF_OR_NULL
Definition: access_path.h:215
@ MATERIALIZE
Definition: access_path.h:251
@ NESTED_LOOP_SEMIJOIN_WITH_DUPLICATE_REMOVAL
Definition: access_path.h:240
@ ROWID_UNION
Definition: access_path.h:225
@ INDEX_SKIP_SCAN
Definition: access_path.h:226
@ MRR
Definition: access_path.h:220
@ CACHE_INVALIDATOR
Definition: access_path.h:259
@ INDEX_SCAN
Definition: access_path.h:213
@ TABLE_VALUE_CONSTRUCTOR
Definition: access_path.h:231
@ WEEDOUT
Definition: access_path.h:255
@ MATERIALIZED_TABLE_FUNCTION
Definition: access_path.h:235
@ REMOVE_DUPLICATES_ON_INDEX
Definition: access_path.h:257
@ TABLE_SCAN
Definition: access_path.h:212
@ REF
Definition: access_path.h:214
@ TEMPTABLE_AGGREGATE
Definition: access_path.h:248
@ LIMIT_OFFSET
Definition: access_path.h:249
@ APPEND
Definition: access_path.h:253
@ NESTED_LOOP_JOIN
Definition: access_path.h:239
@ INDEX_MERGE
Definition: access_path.h:223
@ FULL_TEXT_SEARCH
Definition: access_path.h:218
@ ALTERNATIVE
Definition: access_path.h:258
@ STREAM
Definition: access_path.h:250
@ REMOVE_DUPLICATES
Definition: access_path.h:256
@ ROWID_INTERSECTION
Definition: access_path.h:224
@ DYNAMIC_INDEX_RANGE_SCAN
Definition: access_path.h:228
@ DELETE_ROWS
Definition: access_path.h:262
@ SORT
Definition: access_path.h:246
@ HASH_JOIN
Definition: access_path.h:242
bool retrieve_full_rows
Definition: access_path.h:970
const auto & rowid_union() const
Definition: access_path.h:602
const TABLE * table
Definition: access_path.h:1088
const auto & index_skip_scan() const
Definition: access_path.h:610
auto & dynamic_index_range_scan()
Definition: access_path.h:622
const auto & pushed_join_ref() const
Definition: access_path.h:538
auto & remove_duplicates_on_index()
Definition: access_path.h:806
table_map immediate_tables
Definition: access_path.h:1208
int mrr_flags
Definition: access_path.h:907
auto & full_text_search()
Definition: access_path.h:542
const auto & materialize() const
Definition: access_path.h:762
int ordering_state
Which ordering the rows produced by this path follow, if any (see interesting_orders....
Definition: access_path.h:353
auto & eq_ref()
Definition: access_path.h:526
JoinType join_type
Definition: access_path.h:1060
const auto & limit_offset() const
Definition: access_path.h:746
MaterializePathParameters * param
Definition: access_path.h:1158
const char * cause
Definition: access_path.h:1042
struct AccessPath::@56::@71 index_skip_scan
struct AccessPath::@56::@87 temptable_aggregate
auto & update_rows()
Definition: access_path.h:838
auto & index_merge()
Definition: access_path.h:582
auto & aggregate()
Definition: access_path.h:726
struct AccessPath::@56::@97 alternative
struct AccessPath::@56::@88 limit_offset
struct AccessPath::@56::@90 materialize
struct AccessPath::@56::@98 cache_invalidator
struct AccessPath::@56::@91 materialize_information_schema_table
const auto & group_index_skip_scan() const
Definition: access_path.h:618
auto & zero_rows()
Definition: access_path.h:662
AccessPath * subquery_path
Definition: access_path.h:1126
Mem_root_array< AppendPathParameters > * children
Definition: access_path.h:1168
struct AccessPath::@56::@61 eq_ref
double cost
Expected cost to read all of this access path once; -1.0 for unknown.
Definition: access_path.h:362
struct AccessPath::@56::@63 full_text_search
const auto & nested_loop_join() const
Definition: access_path.h:698
bool already_expanded_predicates
Definition: access_path.h:1070
struct AccessPath::@56::@72 group_index_skip_scan
const auto & remove_duplicates_on_index() const
Definition: access_path.h:810
Temp_table_param * temp_table_param
Definition: access_path.h:1127
auto & nested_loop_semijoin_with_duplicate_removal()
Definition: access_path.h:702
struct AccessPath::@56::@94 weedout
bool reverse
Definition: access_path.h:869
AccessPath * table_scan_path
Definition: access_path.h:1195
const auto & materialize_information_schema_table() const
Definition: access_path.h:770
double subquery_cost
The total cost of executing the queries that we materialize.
Definition: access_path.h:1160
bool geometry
Definition: access_path.h:947
bool count_examined_rows
Whether this access path counts as one that scans a base table, and thus should be counted towards ex...
Definition: access_path.h:298
unsigned loosescan_key_len
Definition: access_path.h:1192
auto & ref()
Definition: access_path.h:510
struct AccessPath::@56::@64 const_table
table_map tables_to_delete_from
Definition: access_path.h:1207
IndexSkipScanParameters * param
Definition: access_path.h:1002
const OverflowBitset & applied_sargable_join_predicates() const
Definition: access_path.h:437
Mem_root_array< AccessPath * > * children
Definition: access_path.h:960
OverflowBitset delayed_predicates
Bitmap of WHERE predicates that touch tables we have joined in, but that we could not apply yet (for ...
Definition: access_path.h:446
AccessPath * table_path
Definition: access_path.h:1020
const auto & aggregate() const
Definition: access_path.h:730
TABLE * table
Definition: access_path.h:863
auto & append()
Definition: access_path.h:774
const auto & weedout() const
Definition: access_path.h:794
const auto & cache_invalidator() const
Definition: access_path.h:826
bool needs_buffering
Definition: access_path.h:1176
int8_t immediate_update_delete_table
For UPDATE and DELETE statements: The node index of a table which can be updated or deleted from imme...
Definition: access_path.h:347
QUICK_RANGE ** ranges
Definition: access_path.h:922
bool is_unique
Definition: access_path.h:890
struct AccessPath::@56::@70 rowid_union
const auto & alternative() const
Definition: access_path.h:818
Safety
A general enum to describe the safety of a given operation.
Definition: access_path.h:273
@ SAFE_IF_SCANNED_ONCE
The given operation is safe if this access path is scanned once, but not if it's scanned multiple tim...
Definition: access_path.h:282
@ UNSAFE
The given operation is unsafe on this access path, no matter how many or few times it's scanned.
Definition: access_path.h:288
@ SAFE
The given operation is always safe on this access path.
Definition: access_path.h:275
auto & const_table()
Definition: access_path.h:550
unsigned mrr_length_per_rec
Definition: access_path.h:1061
const auto & rowid_intersection() const
Definition: access_path.h:594
struct AccessPath::@56::@89 stream
auto & index_range_scan()
Definition: access_path.h:574
double num_output_rows() const
Definition: access_path.h:847
double num_output_rows_before_filter
If no filter, identical to num_output_rows, cost, respectively.
Definition: access_path.h:395
const auto & ref_or_null() const
Definition: access_path.h:522
struct AccessPath::@56::@69 rowid_intersection
Filesort * filesort
Definition: access_path.h:1109
bool store_rowids
Definition: access_path.h:1054
const auto & nested_loop_semijoin_with_duplicate_removal() const
Definition: access_path.h:706
Definition: access_path.h:163
JOIN * join
Definition: access_path.h:165
AccessPath * path
Definition: access_path.h:164
Definition: group_index_skip_scan_plan.h:45
Logically a part of AccessPath::index_skip_scan(), but is too large, so split out into its own struct...
Definition: index_skip_scan_plan.h:73
Structure used for index-based lookups.
Definition: sql_opt_exec_shared.h:67
A specification that two specific relational expressions (e.g., two tables, or a table and a join bet...
Definition: access_path.h:76
int semijoin_group_size
Definition: access_path.h:109
FunctionalDependencySet functional_dependencies
Definition: access_path.h:93
Mem_root_array< int > functional_dependencies_idx
Definition: access_path.h:98
RelationalExpression * expr
Definition: access_path.h:77
double selectivity
Definition: access_path.h:78
int ordering_idx_needed_for_semijoin_rewrite
Definition: access_path.h:103
Item ** semijoin_group
Definition: access_path.h:108
size_t estimated_bytes_per_row
Definition: access_path.h:82
Definition: range_optimizer.h:55
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: materialize_path_parameters.h:42
int select_number
Definition: materialize_path_parameters.h:44
bool copy_items
Definition: materialize_path_parameters.h:47
Temp_table_param * temp_table_param
Definition: materialize_path_parameters.h:48
AccessPath * subquery_path
Definition: materialize_path_parameters.h:43
bool disable_deduplication_by_hash_field
Definition: materialize_path_parameters.h:46
JOIN * join
Definition: materialize_path_parameters.h:45
Definition: materialize_path_parameters.h:40
bool rematerialize
True if rematerializing on every Init() call (e.g., because we have a dependency on a value from outs...
Definition: materialize_path_parameters.h:80
Common_table_expr * cte
If materializing a CTE, points to it (see m_cte), otherwise nullptr.
Definition: materialize_path_parameters.h:65
bool reject_multiple_rows
True if this is the top level iterator for a materialized derived table transformed from a scalar sub...
Definition: materialize_path_parameters.h:99
ha_rows limit_rows
Used for when pushing LIMIT down to MaterializeIterator; this is more efficient than having a LimitOf...
Definition: materialize_path_parameters.h:92
Mem_root_array< QueryBlock > query_blocks
Definition: materialize_path_parameters.h:58
TABLE * table
Handle to table to materialize into.
Definition: materialize_path_parameters.h:62
int ref_slice
Definition: materialize_path_parameters.h:74
Query_expression * unit
The query expression we are materializing.
Definition: materialize_path_parameters.h:68
Mem_root_array< const AccessPath * > * invalidators
Definition: materialize_path_parameters.h:59
A position of table within a join order.
Definition: sql_select.h:352
A filter of some sort that is not a join condition (those are stored in JoinPredicate objects).
Definition: access_path.h:117
hypergraph::NodeMap total_eligibility_set
Definition: access_path.h:130
bool was_join_condition
Definition: access_path.h:143
Mem_root_array< int > functional_dependencies_idx
Definition: access_path.h:155
FunctionalDependencySet functional_dependencies
Definition: access_path.h:154
int source_multiple_equality_idx
Definition: access_path.h:151
hypergraph::NodeMap used_nodes
Definition: access_path.h:121
Item * condition
Definition: access_path.h:118
double selectivity
Definition: access_path.h:132
Mem_root_array< ContainedSubquery > contained_subqueries
Definition: access_path.h:160
Represents an expression tree in the relational algebra of joins.
Definition: relational_expression.h:81
bool is_union_or_table() const
Test if this tmp table stores the result of a UNION set operation or a single table.
Definition: table.h:1551