1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä
2019-11-14 14:49:20 +02:00
49 changed files with 1040 additions and 634 deletions

View File

@@ -3144,7 +3144,22 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
*strategy= SJ_OPT_MATERIALIZE_SCAN;
*read_time= prefix_cost;
*record_count= prefix_rec_count / mat_info->rows_with_duplicates;
/*
Note: the next line means we did not remove the subquery's fanout from
*record_count. It needs to be removed, as the join prefix is
ntX SJM-SCAN(it1 ... itN) | (ot1 ... otN) ...
here, the SJM-SCAN may have introduced subquery's fanout (duplicate rows,
rows that don't have matches in ot1_i). All this fanout is gone after
table otN (or earlier) but taking it into account is hard.
Some consolation here is that SJM-Scan strategy is applicable when the
subquery is smaller than tables otX. If the subquery has large cardinality,
we can greatly overestimate *record_count here, but it doesn't matter as
SJ-Materialization-Lookup is a better strategy anyway.
*/
*record_count= prefix_rec_count;
*handled_fanout= mat_nest->sj_inner_tables;
if (unlikely(join->thd->trace_started()))
{