Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
An engine that turns a correlated scalar subquery into a grouped derived table left-joined on the correlation keys needs the server to split that table by the outer keys, as the subquery probed per outer row. Costed alone, the optimizer may group the whole table instead.
API (sql/table.h)
bool TABLE_LIST::prefer_split= false; - set by the engine; the server only reads it.
Behaviour (JOIN_TAB::choose_best_splitting, sql/opt_split.cc)
- with prefer_split set, a split plan that uses every splitting field (spl_plan->parts >= spl_opt_info->spl_field_cnt) is chosen whatever the costs say
- the join-order search is given min(split cost, unsplit cost) as the startup cost, so the forced split does not change the join order the costs would pick
- a split by fewer fields stays a cost decision
- the flag is read before the function's local table shadows the tab's own
Commit (branch orthus/derived-late-decline, MariaDBEnterprise)
- bffe3d12cca Add TABLE_LIST::prefer_split: an engine-carved derived table split when it can be