MySQL 8.0.29
Source Code Documentation
build_interesting_orders.h File Reference

Go to the source code of this file.

Classes

struct  SortAheadOrdering
 
struct  ActiveIndexInfo
 
struct  FullTextIndexInfo
 

Functions

void BuildInterestingOrders (THD *thd, JoinHypergraph *graph, Query_block *query_block, LogicalOrderings *orderings, Mem_root_array< SortAheadOrdering > *sort_ahead_orderings, int *order_by_ordering_idx, int *group_by_ordering_idx, int *distinct_ordering_idx, Mem_root_array< ActiveIndexInfo > *active_indexes, Mem_root_array< FullTextIndexInfo > *fulltext_searches, std::string *trace)
 Build all structures we need for keeping track of interesting orders. More...
 
ORDERBuildSortAheadOrdering (THD *thd, const LogicalOrderings *orderings, Ordering ordering)
 

Function Documentation

◆ BuildInterestingOrders()

void BuildInterestingOrders ( THD thd,
JoinHypergraph graph,
Query_block query_block,
LogicalOrderings orderings,
Mem_root_array< SortAheadOrdering > *  sort_ahead_orderings,
int *  order_by_ordering_idx,
int *  group_by_ordering_idx,
int *  distinct_ordering_idx,
Mem_root_array< ActiveIndexInfo > *  active_indexes,
Mem_root_array< FullTextIndexInfo > *  fulltext_searches,
std::string *  trace 
)

Build all structures we need for keeping track of interesting orders.

We collect the actual relevant orderings (e.g. from ORDER BY) and any functional dependencies we can find, then ask LogicalOrderings to create its state machine (as defined in interesting_orders.h). The result is said state machine, a list of potential sort-ahead orderings, and a list of what indexes we can use to scan each table (including what orderings they yield, if they are interesting).

◆ BuildSortAheadOrdering()

ORDER * BuildSortAheadOrdering ( THD thd,
const LogicalOrderings orderings,
Ordering  ordering 
)