MySQL 8.4.2
Source Code Documentation
|
Functions | |
table_map | GetUsedTableMap (const ORDER *order) |
bool | OrderItemsReferenceUnavailableTables (const AccessPath *sort_path, table_map used_tables_before_replacement) |
Checks if the order items in a SORT access path reference any column that is not available to it. More... | |
bool anonymous_namespace{finalize_plan.cc}::OrderItemsReferenceUnavailableTables | ( | const AccessPath * | sort_path, |
table_map | used_tables_before_replacement | ||
) |
Checks if the order items in a SORT access path reference any column that is not available to it.
Specifically, it tests that all columns referenced in the order items belong to tables that are available from a child of "sort_path", without any intermediate materialization step between the child and "sort_path".
Say we have an access path tree such as this:
-> Sort -> Nested loop join -> Table scan on t1 -> Materialize -> Table scan on t2
Here, the ordering elements in the sort node may reference columns from t1 or from the materialize node, but not from t2. If they reference columns from t2 directly, it means that something is missing from the set of expressions to materialize from t2. Or that something has gone wrong when rewriting the expressions in the ordering elements to point into the temporary table.