MySQL 8.4.2
Source Code Documentation
|
This struct implements a builder pattern for creating paths that do DISTINCT (sort with duplicate removal) and adding them as parent of the current candidate paths (except for candidate paths that do DISTINCT already). More...
Public Member Functions | |
AccessPathArray | ApplyDistinct () const |
Create new root paths as needed to do DISTINCT. More... | |
Public Attributes | |
THD * | thd |
The current thread. More... | |
const CostingReceiver * | receiver |
The planning context. More... | |
const LogicalOrderings * | orderings |
The set of interesting orders. More... | |
bool | aggregation_is_unordered |
Aggregation (GROUP BY and DISTINCT) do not require ordered inputs and create unordered outputs (. More... | |
int | order_by_ordering_idx |
The order by which the result should be ordered (or -1 if none). More... | |
int | distinct_ordering_idx |
The order by which the result should be grouped. More... | |
const Mem_root_array< SortAheadOrdering > * | sort_ahead_orderings |
The orders we may sort by. More... | |
FunctionalDependencySet | fd_set |
The functional dependencies that apply here. More... | |
Query_block * | query_block |
The enclosing query block. More... | |
bool | need_rowid |
True if we need rowids. More... | |
const AccessPathArray * | root_candidates |
The candidate paths. More... | |
Private Member Functions | |
std::optional< LogicalOrderings::StateIndex > | DistinctOrderingState (size_t grouping_size, const SortAheadOrdering &sort_ahead_ordering) const |
Check if 'sort_ahead_ordering' is a useful order to sort by. More... | |
AccessPath | MakeSortPathForDistinct (AccessPath *root_path, int ordering_idx, LogicalOrderings::StateIndex ordering_state, double output_rows) const |
Create a sort part on top of 'root_path'. More... | |
void | ProposeDistinctPaths (const Bounds_checked_array< Item * > group_items, AccessPath *root_path, double output_rows, AccessPathArray *new_root_candidates) const |
Add a parent path to root_path to ensure that the output is grouped (by distinct_ordering_idx) if this is not the case already. More... | |
This struct implements a builder pattern for creating paths that do DISTINCT (sort with duplicate removal) and adding them as parent of the current candidate paths (except for candidate paths that do DISTINCT already).
The struct eliminates overly long parameter lists, and makes it easy to divide the task into a set of simpler functions.
AccessPathArray anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::ApplyDistinct | ( | ) | const |
Create new root paths as needed to do DISTINCT.
|
private |
Check if 'sort_ahead_ordering' is a useful order to sort by.
grouping_size | The size of the DISTINCT projection. |
sort_ahead_ordering | The candidate ordering. |
|
private |
Create a sort part on top of 'root_path'.
root_path | The path that needs sorting. |
ordering_idx | The order to sort by. |
ordering_state | The ordering state of the new path. |
output_rows | The number of (distinct) output row from the new path. |
|
private |
Add a parent path to root_path to ensure that the output is grouped (by distinct_ordering_idx) if this is not the case already.
Note that we may add multiple alternative parent paths if there are several relevant sort-ahead orders.
group_items | This items we group on. |
root_path | The input path. |
output_rows | The number of (distinct) output rows. |
new_root_candidates | We add parent paths to this. |
bool anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::aggregation_is_unordered |
Aggregation (GROUP BY and DISTINCT) do not require ordered inputs and create unordered outputs (.
int anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::distinct_ordering_idx |
The order by which the result should be grouped.
FunctionalDependencySet anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::fd_set |
The functional dependencies that apply here.
bool anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::need_rowid |
True if we need rowids.
int anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::order_by_ordering_idx |
The order by which the result should be ordered (or -1 if none).
const LogicalOrderings* anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::orderings |
The set of interesting orders.
Query_block* anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::query_block |
The enclosing query block.
const CostingReceiver* anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::receiver |
The planning context.
const AccessPathArray* anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::root_candidates |
The candidate paths.
const Mem_root_array<SortAheadOrdering>* anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::sort_ahead_orderings |
The orders we may sort by.
THD* anonymous_namespace{join_optimizer.cc}::ApplyDistinctParameters::thd |
The current thread.