23#ifndef SQL_JOIN_OPTIMIZER_ACCESS_PATH_H
24#define SQL_JOIN_OPTIMIZER_ACCESS_PATH_H
515 return u.ref_or_null;
519 return u.ref_or_null;
531 return u.pushed_join_ref;
535 return u.pushed_join_ref;
539 return u.full_text_search;
543 return u.full_text_search;
547 return u.const_table;
551 return u.const_table;
563 return u.follow_tail;
567 return u.follow_tail;
571 return u.index_range_scan;
575 return u.index_range_scan;
579 return u.index_merge;
583 return u.index_merge;
587 return u.rowid_intersection;
591 return u.rowid_intersection;
595 return u.rowid_union;
599 return u.rowid_union;
603 return u.index_skip_scan;
607 return u.index_skip_scan;
611 return u.group_index_skip_scan;
615 return u.group_index_skip_scan;
619 return u.dynamic_index_range_scan;
623 return u.dynamic_index_range_scan;
627 return u.materialized_table_function;
631 return u.materialized_table_function;
635 return u.unqualified_count;
639 return u.unqualified_count;
643 return u.table_value_constructor;
647 return u.table_value_constructor;
651 return u.fake_single_row;
655 return u.fake_single_row;
667 return u.zero_rows_aggregated;
671 return u.zero_rows_aggregated;
691 return u.nested_loop_join;
695 return u.nested_loop_join;
699 return u.nested_loop_semijoin_with_duplicate_removal;
703 return u.nested_loop_semijoin_with_duplicate_removal;
731 return u.temptable_aggregate;
735 return u.temptable_aggregate;
739 return u.limit_offset;
743 return u.limit_offset;
755 return u.materialize;
759 return u.materialize;
763 return u.materialize_information_schema_table;
767 return u.materialize_information_schema_table;
795 return u.remove_duplicates;
799 return u.remove_duplicates;
803 return u.remove_duplicates_on_index;
807 return u.remove_duplicates_on_index;
811 return u.alternative;
815 return u.alternative;
819 return u.cache_invalidator;
823 return u.cache_invalidator;
827 return u.delete_rows;
831 return u.delete_rows;
835 return u.update_rows;
839 return u.update_rows;
1212static_assert(std::is_trivially_destructible<AccessPath>::value,
1213 "AccessPath must be trivially destructible, as it is allocated "
1214 "on the MEM_ROOT and not wrapped in unique_ptr_destroy_only"
1215 "(because multiple candidates during planning could point to "
1216 "the same access paths, and refcounting would be expensive)");
1218 "We are creating a lot of access paths in the join "
1219 "optimizer, so be sure not to bloat it without noticing. "
1220 "(96 bytes for the base, 48 bytes for the variant.)");
1235 bool count_examined_rows) {
1238 path->count_examined_rows = count_examined_rows;
1239 path->table_scan().table = table;
1245 bool count_examined_rows) {
1248 path->count_examined_rows = count_examined_rows;
1249 path->index_scan().table = table;
1250 path->index_scan().idx = idx;
1251 path->index_scan().use_order = use_order;
1258 bool count_examined_rows) {
1261 path->count_examined_rows = count_examined_rows;
1262 path->ref().table = table;
1264 path->ref().use_order = use_order;
1271 bool count_examined_rows) {
1274 path->count_examined_rows = count_examined_rows;
1275 path->ref_or_null().table = table;
1276 path->ref_or_null().ref =
ref;
1277 path->ref_or_null().use_order = use_order;
1282 bool count_examined_rows) {
1285 path->count_examined_rows = count_examined_rows;
1286 path->eq_ref().table = table;
1294 bool count_examined_rows) {
1297 path->count_examined_rows = count_examined_rows;
1298 path->pushed_join_ref().table = table;
1299 path->pushed_join_ref().ref =
ref;
1300 path->pushed_join_ref().use_order = use_order;
1301 path->pushed_join_ref().is_unique = is_unique;
1308 bool use_order,
bool use_limit,
1309 bool count_examined_rows) {
1312 path->count_examined_rows = count_examined_rows;
1313 path->full_text_search().table = table;
1314 path->full_text_search().ref =
ref;
1315 path->full_text_search().use_order = use_order;
1316 path->full_text_search().use_limit = use_limit;
1317 path->full_text_search().ft_func = ft_func;
1323 bool count_examined_rows) {
1326 path->count_examined_rows = count_examined_rows;
1327 path->set_num_output_rows(1.0);
1329 path->init_cost = 0.0;
1330 path->init_once_cost = 0.0;
1331 path->const_table().table = table;
1332 path->const_table().ref =
ref;
1340 path->mrr().table = table;
1342 path->mrr().mrr_flags = mrr_flags;
1345 path->mrr().bka_path =
nullptr;
1351 bool count_examined_rows) {
1354 path->count_examined_rows = count_examined_rows;
1355 path->follow_tail().table = table;
1363 path->count_examined_rows = count_examined_rows;
1364 path->dynamic_index_range_scan().table = table;
1365 path->dynamic_index_range_scan().qep_tab = qep_tab;
1374 path->materialized_table_function().table = table;
1375 path->materialized_table_function().table_function = table_function;
1376 path->materialized_table_function().table_path = table_path;
1391 path->count_examined_rows =
true;
1397 KEY *
key,
size_t key_len) {
1400 path->nested_loop_semijoin_with_duplicate_removal().outer = outer;
1401 path->nested_loop_semijoin_with_duplicate_removal().inner = inner;
1402 path->nested_loop_semijoin_with_duplicate_removal().table = table;
1403 path->nested_loop_semijoin_with_duplicate_removal().key =
key;
1404 path->nested_loop_semijoin_with_duplicate_removal().key_len = key_len;
1412 path->filter().child = child;
1413 path->filter().condition = condition;
1414 path->filter().materialize_subqueries =
false;
1421 ORDER *order,
bool count_examined_rows);
1427 path->aggregate().child = child;
1428 path->aggregate().rollup = rollup;
1437 path->temptable_aggregate().subquery_path = subquery_path;
1438 path->temptable_aggregate().temp_table_param = temp_table_param;
1439 path->temptable_aggregate().table = table;
1440 path->temptable_aggregate().table_path = table_path;
1441 path->temptable_aggregate().ref_slice = ref_slice;
1447 bool count_all_rows,
1448 bool reject_multiple_rows,
1449 ha_rows *send_records_override) {
1453 path->immediate_update_delete_table = child->immediate_update_delete_table;
1454 path->limit_offset().child = child;
1455 path->limit_offset().limit = limit;
1456 path->limit_offset().offset = offset;
1457 path->limit_offset().count_all_rows = count_all_rows;
1458 path->limit_offset().reject_multiple_rows = reject_multiple_rows;
1459 path->limit_offset().send_records_override = send_records_override;
1460 path->ordering_state = child->ordering_state;
1466 bool count_examined_rows) {
1469 path->count_examined_rows = count_examined_rows;
1470 path->set_num_output_rows(1.0);
1472 path->init_cost = 0.0;
1473 path->init_once_cost = 0.0;
1478 const char *cause) {
1481 path->zero_rows().child = child;
1482 path->zero_rows().cause = cause;
1483 path->set_num_output_rows(0.0);
1485 path->init_cost = 0.0;
1486 path->init_once_cost = 0.0;
1487 path->num_output_rows_before_filter = 0.0;
1488 path->cost_before_filter = 0.0;
1497 const char *cause) {
1500 path->zero_rows_aggregated().cause = cause;
1501 path->set_num_output_rows(1.0);
1503 path->init_cost = 0.0;
1510 TABLE *table,
int ref_slice) {
1513 path->stream().child = child;
1515 path->stream().temp_table_param = temp_table_param;
1516 path->stream().table = table;
1517 path->stream().ref_slice = ref_slice;
1519 path->stream().provide_rowid =
false;
1527 assert(
path !=
nullptr);
1544 int ref_slice,
bool rematerialize,
ha_rows limit_rows,
1545 bool reject_multiple_rows) {
1549 if (rematerialize) {
1556 param->
table = table;
1578 path->materialize().table_path = table_path;
1579 path->materialize().param = param;
1580 path->materialize().subquery_cost = -1.0;
1581 if (rematerialize) {
1594 path->materialize_information_schema_table().table_path = table_path;
1595 path->materialize_information_schema_table().table_list = table_list;
1596 path->materialize_information_schema_table().condition = condition;
1606 path->append().children = children;
1608 path->init_cost = 0.0;
1609 path->init_once_cost = 0.0;
1611 path->cost += child.path->cost;
1612 path->init_cost += child.path->init_cost;
1613 path->init_once_cost += child.path->init_once_cost;
1621 int ref_slice,
bool needs_buffering) {
1624 path->window().child = child;
1625 path->window().window = window;
1626 path->window().temp_table =
nullptr;
1627 path->window().temp_table_param = temp_table_param;
1628 path->window().ref_slice = ref_slice;
1629 path->window().needs_buffering = needs_buffering;
1637 path->weedout().child = child;
1638 path->weedout().weedout_table = weedout_table;
1639 path->weedout().tables_to_get_rowid_for =
1646 int group_items_size) {
1649 path->remove_duplicates().child = child;
1650 path->remove_duplicates().group_items = group_items;
1651 path->remove_duplicates().group_items_size = group_items_size;
1657 unsigned loosescan_key_len) {
1660 path->remove_duplicates_on_index().child = child;
1661 path->remove_duplicates_on_index().table = table;
1662 path->remove_duplicates_on_index().key =
key;
1663 path->remove_duplicates_on_index().loosescan_key_len = loosescan_key_len;
1672 path->alternative().table_scan_path = table_scan_path;
1673 path->alternative().child = child;
1674 path->alternative().used_ref = used_ref;
1682 path->cache_invalidator().child = child;
1683 path->cache_invalidator().name =
name;
1716 bool eligible_for_batch_mode);
1724 eligible_for_batch_mode);
1728 const POSITION *pos,
bool is_after_filter,
1775 unsigned num_where_predicates);
1783 int num_where_predicates);
1789 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:1507
AccessPath * NewRemoveDuplicatesAccessPath(THD *thd, AccessPath *child, Item **group_items, int group_items_size)
Definition: access_path.h:1644
AccessPath * NewInvalidatorAccessPath(THD *thd, AccessPath *child, const char *name)
Definition: access_path.h:1678
AccessPath * NewRefAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool use_order, bool reverse, bool count_examined_rows)
Definition: access_path.h:1256
AccessPath * NewDeleteRowsAccessPath(THD *thd, AccessPath *child, table_map delete_tables, table_map immediate_tables)
Definition: access_path.cc:100
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:284
void CopyBasicProperties(const AccessPath &from, AccessPath *to)
Definition: access_path.h:1222
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:1325
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:1305
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:1432
table_map GetHashJoinTables(AccessPath *path)
Returns the tables that are part of a hash join.
Definition: access_path.cc:1447
AccessPath * NewDynamicIndexRangeScanAccessPath(THD *thd, TABLE *table, QEP_TAB *qep_tab, bool count_examined_rows)
Definition: access_path.h:1359
AccessPath * NewZeroRowsAggregatedAccessPath(THD *thd, const char *cause)
Definition: access_path.h:1496
AccessPath * NewAlternativeAccessPath(THD *thd, AccessPath *child, AccessPath *table_scan_path, Index_lookup *used_ref)
Definition: access_path.h:1667
AccessPath * NewUpdateRowsAccessPath(THD *thd, AccessPath *child, table_map delete_tables, table_map immediate_tables)
Definition: access_path.cc:112
AccessPath * NewMRRAccessPath(THD *thd, TABLE *table, Index_lookup *ref, int mrr_flags)
Definition: access_path.h:1336
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:214
AccessPath * NewAppendAccessPath(THD *thd, Mem_root_array< AppendPathParameters > *children)
Definition: access_path.h:1602
AccessPath * NewNestedLoopSemiJoinWithDuplicateRemovalAccessPath(THD *thd, AccessPath *outer, AccessPath *inner, const TABLE *table, KEY *key, size_t key_len)
Definition: access_path.h:1395
AccessPath * NewRemoveDuplicatesOnIndexAccessPath(THD *thd, AccessPath *child, TABLE *table, KEY *key, unsigned loosescan_key_len)
Definition: access_path.h:1655
AccessPath * NewFakeSingleRowAccessPath(THD *thd, bool count_examined_rows)
Definition: access_path.h:1465
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:1314
AccessPath * NewFilterAccessPath(THD *thd, AccessPath *child, Item *condition)
Definition: access_path.h:1408
AccessPath * NewSortAccessPath(THD *thd, AccessPath *child, Filesort *filesort, ORDER *order, bool count_examined_rows)
Definition: access_path.cc:65
AccessPath * NewMaterializedTableFunctionAccessPath(THD *thd, TABLE *table, Table_function *table_function, AccessPath *table_path)
Definition: access_path.h:1369
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:1539
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:245
AccessPath * NewTableScanAccessPath(THD *thd, TABLE *table, bool count_examined_rows)
Definition: access_path.h:1234
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:1435
AccessPath * NewMaterializeInformationSchemaTableAccessPath(THD *thd, AccessPath *table_path, Table_ref *table_list, Item *condition)
Definition: access_path.h:1590
void FindTablesToGetRowidFor(AccessPath *path)
Modifies "path" and the paths below it so that they provide row IDs for all tables.
Definition: access_path.cc:1170
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:1524
AccessPath * NewAggregateAccessPath(THD *thd, AccessPath *child, bool rollup)
Definition: access_path.h:1423
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:161
AccessPath * NewRefOrNullAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool use_order, bool count_examined_rows)
Definition: access_path.h:1269
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:1445
AccessPath * NewEQRefAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool count_examined_rows)
Definition: access_path.h:1281
AccessPath * NewWindowAccessPath(THD *thd, AccessPath *child, Window *window, Temp_table_param *temp_table_param, int ref_slice, bool needs_buffering)
Definition: access_path.h:1618
AccessPath * NewFollowTailAccessPath(THD *thd, TABLE *table, bool count_examined_rows)
Definition: access_path.h:1350
AccessPath * NewTableValueConstructorAccessPath(THD *thd)
Definition: access_path.h:1386
AccessPath * NewConstTableAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool count_examined_rows)
Definition: access_path.h:1321
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:354
AccessPath * NewWeedoutAccessPath(THD *thd, AccessPath *child, SJ_TMP_TABLE *weedout_table)
Definition: access_path.h:1633
AccessPath * NewPushedJoinRefAccessPath(THD *thd, TABLE *table, Index_lookup *ref, bool use_order, bool is_unique, bool count_examined_rows)
Definition: access_path.h:1291
AccessPath * NewZeroRowsAccessPath(THD *thd, AccessPath *child, const char *cause)
Definition: access_path.h:1477
AccessPath * NewUnqualifiedCountAccessPath(THD *thd)
Definition: access_path.h:1380
AccessPath * NewIndexScanAccessPath(THD *thd, TABLE *table, int idx, bool use_order, bool reverse, bool count_examined_rows)
Definition: access_path.h:1243
A wrapper class which provides array bounds checking.
Definition: sql_array.h:46
After parsing, a Common Table Expression is accessed through a Table_ref.
Definition: table.h:4291
API for getting cost estimates for server operations that are not directly related to a table object.
Definition: opt_costmodel.h:51
Sorting related info.
Definition: filesort.h:51
Definition: item_func.h:3417
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:850
Definition: sql_optimizer.h:125
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:425
Definition: overflow_bitset.h:76
Definition: sql_executor.h:259
Definition: range_optimizer.h:68
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:81
Definition: sql_executor.h:103
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
MEM_ROOT * mem_root
Definition: sql_lexer_thd.h:37
Class representing a table function.
Definition: table_function.h:52
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:94
Represents the (explicit) window of a SQL 2003 section 7.11 <window clause>, or the implicit (inlined...
Definition: window.h:104
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
void EstimateLimitOffsetCost(AccessPath *path)
Estimate the costs and row count for a LIMIT_OFFSET AccessPath.
Definition: cost_model.cc:801
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:366
void SetCostOnTableAccessPath(const Cost_model_server &cost_model, const POSITION *pos, bool is_after_filter, AccessPath *path)
Definition: sql_executor.cc:1852
std::bitset< kMaxSupportedFDs > FunctionalDependencySet
Definition: interesting_orders_defs.h:62
JoinType
Definition: join_type.h:27
static mi_bit_type mask[]
Definition: mi_packrec.cc:140
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:488
my_off_t ha_rows
Definition: my_base.h:1139
#define HA_POS_ERROR
Definition: my_base.h:1141
uint64_t table_map
Definition: my_table_map.h:29
static char * path
Definition: mysqldump.cc:133
PT & ref(PT *tp)
Definition: tablespace_impl.cc:358
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:39
RangeReverse< Range > reverse(Range &x)
Iterate over a range in reverse.
Definition: utilities.h:131
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:150
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:59
case opt name
Definition: sslopt-case.h:32
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:189
auto & weedout()
Definition: access_path.h:785
auto & filter()
Definition: access_path.h:705
bool count_all_rows
Definition: access_path.h:1131
AccessPath * bka_path
Definition: access_path.h:901
auto & ref_or_null()
Definition: access_path.h:513
auto & materialized_table_function()
Definition: access_path.h:625
AccessPath * cpk_child
Definition: access_path.h:962
auto & rowid_union()
Definition: access_path.h:593
double cost_before_filter
Definition: access_path.h:391
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:477
const auto & bka_join() const
Definition: access_path.h:685
TABLE * temp_table
Definition: access_path.h:1168
OverflowBitset equijoin_predicates
Definition: access_path.h:1072
Item ** group_items
Definition: access_path.h:1180
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:387
bool rollup
Definition: access_path.h:1118
auto & materialize()
Definition: access_path.h:753
const auto & temptable_aggregate() const
Definition: access_path.h:733
OverflowBitset & subsumed_sargable_join_predicates()
Similar to applied_sargable_join_predicates, bitmap of sargable join predicates that have been applie...
Definition: access_path.h:449
auto & index_scan()
Definition: access_path.h:497
const auto & delete_rows() const
Definition: access_path.h:829
struct AccessPath::@55::@81 nested_loop_join
const auto & filter() const
Definition: access_path.h:709
auto & delete_rows()
Definition: access_path.h:825
bool reuse_handler
Definition: access_path.h:939
KEY_PART * used_key_part
Definition: access_path.h:913
struct AccessPath::@55::@90 materialize_information_schema_table
struct AccessPath::@55::@71 group_index_skip_scan
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:429
Item * condition
Definition: access_path.h:1090
struct AccessPath::@55::@74 unqualified_count
const auto & index_merge() const
Definition: access_path.h:581
const auto & update_rows() const
Definition: access_path.h:837
enum AccessPath::Type type
auto & alternative()
Definition: access_path.h:809
auto & pushed_join_ref()
Definition: access_path.h:529
AccessPath * outer
Definition: access_path.h:1046
auto & index_skip_scan()
Definition: access_path.h:601
struct AccessPath::@55::@95 remove_duplicates_on_index
bool rewrite_semi_to_inner
Definition: access_path.h:1050
const auto & zero_rows_aggregated() const
Definition: access_path.h:669
auto & group_index_skip_scan()
Definition: access_path.h:609
struct AccessPath::@55::@76 fake_single_row
const auto & eq_ref() const
Definition: access_path.h:525
int group_items_size
Definition: access_path.h:1181
bool use_order
Definition: access_path.h:863
struct AccessPath::@55::@88 stream
bool pfs_batch_mode
Definition: access_path.h:1064
auto & temptable_aggregate()
Definition: access_path.h:729
AccessPath()
Definition: access_path.h:195
GroupIndexSkipScanParameters * param
Definition: access_path.h:1006
auto & rowid_intersection()
Definition: access_path.h:585
bool materialize_subqueries
Definition: access_path.h:1100
AccessPath * child
Definition: access_path.h:1034
bool allow_spill_to_disk
Definition: access_path.h:1048
Index_lookup * used_ref
Definition: access_path.h:1194
struct AccessPath::@55::@78 zero_rows_aggregated
auto & mrr()
Definition: access_path.h:553
struct AccessPath::@55::@70 index_skip_scan
const auto & index_scan() const
Definition: access_path.h:501
const auto & fake_single_row() const
Definition: access_path.h:653
bool reject_multiple_rows
Definition: access_path.h:1132
bool allow_clustered_primary_key_scan
Definition: access_path.h:954
const char * name
Definition: access_path.h:1198
bool use_limit
Definition: access_path.h:891
Window * window
Definition: access_path.h:1167
table_map tables_to_get_rowid_for
Definition: access_path.h:1051
auto & materialize_information_schema_table()
Definition: access_path.h:761
auto & bka_join()
Definition: access_path.h:681
const auto & follow_tail() const
Definition: access_path.h:565
struct AccessPath::@55::@83 filter
SJ_TMP_TABLE * weedout_table
Definition: access_path.h:1175
Index_lookup * ref
Definition: access_path.h:868
const auto & window() const
Definition: access_path.h:781
const auto & materialized_table_function() const
Definition: access_path.h:629
auto & unqualified_count()
Definition: access_path.h:633
bool keep_current_rowid
Definition: access_path.h:903
bool using_extended_key_parts
Definition: access_path.h:949
auto & nested_loop_join()
Definition: access_path.h:689
const auto & full_text_search() const
Definition: access_path.h:541
bool can_be_used_for_ror
Definition: access_path.h:929
float rec_per_key
Definition: access_path.h:1057
Safety safe_for_rowid
Whether it is safe to get row IDs (for sorting) from this access path.
Definition: access_path.h:288
JOIN * join
Definition: access_path.h:1139
struct AccessPath::@55::@69 rowid_union
unsigned index
Definition: access_path.h:925
unsigned mrr_buf_size
Definition: access_path.h:921
struct AccessPath::@55::@60 eq_ref
auto & remove_duplicates()
Definition: access_path.h:793
struct AccessPath::@55::@68 rowid_intersection
struct AccessPath::@55::@61 pushed_join_ref
struct AccessPath::@55::@63 const_table
RowIterator * iterator
If an iterator has been instantiated for this access path, points to the iterator.
Definition: access_path.h:355
const auto & stream() const
Definition: access_path.h:749
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:367
const auto & remove_duplicates() const
Definition: access_path.h:797
auto & window()
Definition: access_path.h:777
bool need_rows_in_rowid_order
Definition: access_path.h:933
Table_ref * table_list
Definition: access_path.h:1159
const auto & unqualified_count() const
Definition: access_path.h:637
void * secondary_engine_data
Auxiliary data used by a secondary storage engine while processing the access path during optimizatio...
Definition: access_path.h:486
struct AccessPath::@55::@86 temptable_aggregate
struct AccessPath::@55::@85 aggregate
void set_num_output_rows(double val)
Definition: access_path.h:844
bool is_covering
Definition: access_path.h:982
const auto & mrr() const
Definition: access_path.h:557
bool remove_duplicates
Definition: access_path.h:1112
table_map tables_to_update
Definition: access_path.h:1207
const auto & table_value_constructor() const
Definition: access_path.h:645
KEY * key
Definition: access_path.h:1084
auto & table_value_constructor()
Definition: access_path.h:641
auto & stream()
Definition: access_path.h:745
size_t key_len
Definition: access_path.h:1085
const OverflowBitset & subsumed_sargable_join_predicates() const
Definition: access_path.h:452
const auto & zero_rows() const
Definition: access_path.h:661
const auto & append() const
Definition: access_path.h:773
ha_rows offset
Definition: access_path.h:1130
int idx
Definition: access_path.h:862
struct AccessPath::@55::@87 limit_offset
auto & hash_join()
Definition: access_path.h:673
auto & cache_invalidator()
Definition: access_path.h:817
struct AccessPath::@55::@73 materialized_table_function
bool force_sort_rowids
Definition: access_path.h:1114
unsigned num_used_key_parts
Definition: access_path.h:926
unsigned num_ranges
Definition: access_path.h:918
ORDER * order
Definition: access_path.h:1110
auto & sort()
Definition: access_path.h:713
auto & fake_single_row()
Definition: access_path.h:649
ha_rows limit
Definition: access_path.h:1111
auto & follow_tail()
Definition: access_path.h:561
double m_num_output_rows
Expected number of output rows, -1.0 for unknown.
Definition: access_path.h:848
const JoinPredicate * join_predicate
Definition: access_path.h:1047
const auto & const_table() const
Definition: access_path.h:549
const auto & dynamic_index_range_scan() const
Definition: access_path.h:621
const auto & table_scan() const
Definition: access_path.h:493
unsigned mrr_flags
Definition: access_path.h:920
int ref_slice
Definition: access_path.h:1125
OverflowBitset filter_predicates
Bitmap of WHERE predicates that we are including on this access path, referring to the “predicates” a...
Definition: access_path.h:413
bool can_be_used_for_imerge
Definition: access_path.h:936
bool forced_by_hint
Definition: access_path.h:953
auto & limit_offset()
Definition: access_path.h:737
AccessPath * inner
Definition: access_path.h:1046
bool provide_rowid
Definition: access_path.h:1142
const auto & index_range_scan() const
Definition: access_path.h:573
struct AccessPath::@55::@59 ref_or_null
const auto & ref() const
Definition: access_path.h:509
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:299
Item_func_match * ft_func
Definition: access_path.h:892
struct AccessPath::@55::@79 hash_join
ha_rows * send_records_override
Definition: access_path.h:1135
struct AccessPath::@55::@77 zero_rows
auto & table_scan()
Definition: access_path.h:489
const auto & hash_join() const
Definition: access_path.h:677
QEP_TAB * qep_tab
Definition: access_path.h:1010
Table_function * table_function
Definition: access_path.h:1014
auto & zero_rows_aggregated()
Definition: access_path.h:665
const auto & sort() const
Definition: access_path.h:717
bool unwrap_rollup
Definition: access_path.h:1113
struct AccessPath::@55::@93 weedout
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:379
Type
Definition: access_path.h:204
@ FOLLOW_TAIL
Definition: access_path.h:217
@ FILTER
Definition: access_path.h:241
@ PUSHED_JOIN_REF
Definition: access_path.h:213
@ ZERO_ROWS_AGGREGATED
Definition: access_path.h:230
@ UPDATE_ROWS
Definition: access_path.h:259
@ AGGREGATE
Definition: access_path.h:243
@ BKA_JOIN
Definition: access_path.h:237
@ ZERO_ROWS
Definition: access_path.h:229
@ CONST_TABLE
Definition: access_path.h:215
@ GROUP_INDEX_SKIP_SCAN
Definition: access_path.h:223
@ INDEX_RANGE_SCAN
Definition: access_path.h:218
@ UNQUALIFIED_COUNT
Definition: access_path.h:232
@ EQ_REF
Definition: access_path.h:212
@ FAKE_SINGLE_ROW
Definition: access_path.h:228
@ MATERIALIZE_INFORMATION_SCHEMA_TABLE
Definition: access_path.h:248
@ WINDOW
Definition: access_path.h:250
@ REF_OR_NULL
Definition: access_path.h:211
@ MATERIALIZE
Definition: access_path.h:247
@ NESTED_LOOP_SEMIJOIN_WITH_DUPLICATE_REMOVAL
Definition: access_path.h:236
@ ROWID_UNION
Definition: access_path.h:221
@ INDEX_SKIP_SCAN
Definition: access_path.h:222
@ MRR
Definition: access_path.h:216
@ CACHE_INVALIDATOR
Definition: access_path.h:255
@ INDEX_SCAN
Definition: access_path.h:209
@ TABLE_VALUE_CONSTRUCTOR
Definition: access_path.h:227
@ WEEDOUT
Definition: access_path.h:251
@ MATERIALIZED_TABLE_FUNCTION
Definition: access_path.h:231
@ REMOVE_DUPLICATES_ON_INDEX
Definition: access_path.h:253
@ TABLE_SCAN
Definition: access_path.h:208
@ REF
Definition: access_path.h:210
@ TEMPTABLE_AGGREGATE
Definition: access_path.h:244
@ LIMIT_OFFSET
Definition: access_path.h:245
@ APPEND
Definition: access_path.h:249
@ NESTED_LOOP_JOIN
Definition: access_path.h:235
@ INDEX_MERGE
Definition: access_path.h:219
@ FULL_TEXT_SEARCH
Definition: access_path.h:214
@ ALTERNATIVE
Definition: access_path.h:254
@ STREAM
Definition: access_path.h:246
@ REMOVE_DUPLICATES
Definition: access_path.h:252
@ ROWID_INTERSECTION
Definition: access_path.h:220
@ DYNAMIC_INDEX_RANGE_SCAN
Definition: access_path.h:224
@ DELETE_ROWS
Definition: access_path.h:258
@ SORT
Definition: access_path.h:242
@ HASH_JOIN
Definition: access_path.h:238
bool retrieve_full_rows
Definition: access_path.h:965
const auto & rowid_union() const
Definition: access_path.h:597
const TABLE * table
Definition: access_path.h:1083
const auto & index_skip_scan() const
Definition: access_path.h:605
auto & dynamic_index_range_scan()
Definition: access_path.h:617
const auto & pushed_join_ref() const
Definition: access_path.h:533
struct AccessPath::@55::@72 dynamic_index_range_scan
auto & remove_duplicates_on_index()
Definition: access_path.h:801
table_map immediate_tables
Definition: access_path.h:1203
struct AccessPath::@55::@64 mrr
int mrr_flags
Definition: access_path.h:902
auto & full_text_search()
Definition: access_path.h:537
const auto & materialize() const
Definition: access_path.h:757
int ordering_state
Which ordering the rows produced by this path follow, if any (see interesting_orders....
Definition: access_path.h:349
auto & eq_ref()
Definition: access_path.h:521
JoinType join_type
Definition: access_path.h:1055
struct AccessPath::@55::@84 sort
struct AccessPath::@55::@66 index_range_scan
struct AccessPath::@55::@97 cache_invalidator
const auto & limit_offset() const
Definition: access_path.h:741
MaterializePathParameters * param
Definition: access_path.h:1153
const char * cause
Definition: access_path.h:1037
struct AccessPath::@55::@98 delete_rows
auto & update_rows()
Definition: access_path.h:833
auto & index_merge()
Definition: access_path.h:577
auto & aggregate()
Definition: access_path.h:721
struct AccessPath::@55::@62 full_text_search
const auto & group_index_skip_scan() const
Definition: access_path.h:613
auto & zero_rows()
Definition: access_path.h:657
AccessPath * subquery_path
Definition: access_path.h:1121
Mem_root_array< AppendPathParameters > * children
Definition: access_path.h:1163
double cost
Expected cost to read all of this access path once; -1.0 for unknown.
Definition: access_path.h:358
const auto & nested_loop_join() const
Definition: access_path.h:693
struct AccessPath::@55::@96 alternative
bool already_expanded_predicates
Definition: access_path.h:1065
const auto & remove_duplicates_on_index() const
Definition: access_path.h:805
struct AccessPath::@55::@67 index_merge
Temp_table_param * temp_table_param
Definition: access_path.h:1122
auto & nested_loop_semijoin_with_duplicate_removal()
Definition: access_path.h:697
bool reverse
Definition: access_path.h:864
AccessPath * table_scan_path
Definition: access_path.h:1190
const auto & materialize_information_schema_table() const
Definition: access_path.h:765
double subquery_cost
The total cost of executing the queries that we materialize.
Definition: access_path.h:1155
bool geometry
Definition: access_path.h:942
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:294
unsigned loosescan_key_len
Definition: access_path.h:1187
auto & ref()
Definition: access_path.h:505
struct AccessPath::@55::@80 bka_join
struct AccessPath::@55::@82 nested_loop_semijoin_with_duplicate_removal
table_map tables_to_delete_from
Definition: access_path.h:1202
struct AccessPath::@55::@57 index_scan
IndexSkipScanParameters * param
Definition: access_path.h:997
const OverflowBitset & applied_sargable_join_predicates() const
Definition: access_path.h:432
Mem_root_array< AccessPath * > * children
Definition: access_path.h:955
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:441
AccessPath * table_path
Definition: access_path.h:1015
const auto & aggregate() const
Definition: access_path.h:725
TABLE * table
Definition: access_path.h:858
auto & append()
Definition: access_path.h:769
struct AccessPath::@55::@99 update_rows
const auto & weedout() const
Definition: access_path.h:789
const auto & cache_invalidator() const
Definition: access_path.h:821
bool needs_buffering
Definition: access_path.h:1171
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:343
QUICK_RANGE ** ranges
Definition: access_path.h:917
bool is_unique
Definition: access_path.h:885
const auto & alternative() const
Definition: access_path.h:813
Safety
A general enum to describe the safety of a given operation.
Definition: access_path.h:269
@ 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:278
@ UNSAFE
The given operation is unsafe on this access path, no matter how many or few times it's scanned.
Definition: access_path.h:284
@ SAFE
The given operation is always safe on this access path.
Definition: access_path.h:271
auto & const_table()
Definition: access_path.h:545
struct AccessPath::@55::@75 table_value_constructor
unsigned mrr_length_per_rec
Definition: access_path.h:1056
struct AccessPath::@55::@65 follow_tail
const auto & rowid_intersection() const
Definition: access_path.h:589
auto & index_range_scan()
Definition: access_path.h:569
double num_output_rows() const
Definition: access_path.h:842
struct AccessPath::@55::@89 materialize
double num_output_rows_before_filter
If no filter, identical to num_output_rows, cost, respectively.
Definition: access_path.h:391
const auto & ref_or_null() const
Definition: access_path.h:517
struct AccessPath::@55::@91 append
Filesort * filesort
Definition: access_path.h:1104
bool store_rowids
Definition: access_path.h:1049
const auto & nested_loop_semijoin_with_duplicate_removal() const
Definition: access_path.h:701
struct AccessPath::@55::@56 table_scan
Definition: access_path.h:162
JOIN * join
Definition: access_path.h:164
AccessPath * path
Definition: access_path.h:163
Definition: group_index_skip_scan_plan.h:44
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:72
Structure used for index-based lookups.
Definition: sql_opt_exec_shared.h:66
A specification that two specific relational expressions (e.g., two tables, or a table and a join bet...
Definition: access_path.h:75
int semijoin_group_size
Definition: access_path.h:108
FunctionalDependencySet functional_dependencies
Definition: access_path.h:92
Mem_root_array< int > functional_dependencies_idx
Definition: access_path.h:97
RelationalExpression * expr
Definition: access_path.h:76
double selectivity
Definition: access_path.h:77
int ordering_idx_needed_for_semijoin_rewrite
Definition: access_path.h:102
Item ** semijoin_group
Definition: access_path.h:107
size_t estimated_bytes_per_row
Definition: access_path.h:81
Definition: range_optimizer.h:54
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: materialize_path_parameters.h:41
int select_number
Definition: materialize_path_parameters.h:43
bool copy_items
Definition: materialize_path_parameters.h:46
Temp_table_param * temp_table_param
Definition: materialize_path_parameters.h:47
AccessPath * subquery_path
Definition: materialize_path_parameters.h:42
bool disable_deduplication_by_hash_field
Definition: materialize_path_parameters.h:45
JOIN * join
Definition: materialize_path_parameters.h:44
Definition: materialize_path_parameters.h:39
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:79
Common_table_expr * cte
If materializing a CTE, points to it (see m_cte), otherwise nullptr.
Definition: materialize_path_parameters.h:64
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:98
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:91
Mem_root_array< QueryBlock > query_blocks
Definition: materialize_path_parameters.h:57
TABLE * table
Handle to table to materialize into.
Definition: materialize_path_parameters.h:61
int ref_slice
Definition: materialize_path_parameters.h:73
Query_expression * unit
The query expression we are materializing.
Definition: materialize_path_parameters.h:67
Mem_root_array< const AccessPath * > * invalidators
Definition: materialize_path_parameters.h:58
A position of table within a join order.
Definition: sql_select.h:351
A filter of some sort that is not a join condition (those are stored in JoinPredicate objects).
Definition: access_path.h:116
hypergraph::NodeMap total_eligibility_set
Definition: access_path.h:129
bool was_join_condition
Definition: access_path.h:142
Mem_root_array< int > functional_dependencies_idx
Definition: access_path.h:154
FunctionalDependencySet functional_dependencies
Definition: access_path.h:153
int source_multiple_equality_idx
Definition: access_path.h:150
hypergraph::NodeMap used_nodes
Definition: access_path.h:120
Item * condition
Definition: access_path.h:117
double selectivity
Definition: access_path.h:131
Mem_root_array< ContainedSubquery > contained_subqueries
Definition: access_path.h:159
Represents an expression tree in the relational algebra of joins.
Definition: relational_expression.h:80
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:1547