mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-20109: Optimizer ignores distinct key created for materialized...
(Backported to 10.3, addressed review input) Sj_materialization_picker::check_qep(): fix error in cost/fanout calculations: - for each join prefix, add #prefix_rows / TIME_FOR_COMPARE to the cost, like best_extension_by_limited_search does - Remove the fanout produced by the subquery tables. - Also take into account join condition selectivity optimize_wo_join_buffering() (used by LooseScan and FirstMatch) - also add #prefix_rows / TIME_FOR_COMPARE to the cost of each prefix. - Also take into account join condition selectivity
This commit is contained in:
@ -727,8 +727,8 @@ SELECT a FROM t1 AS t, t2
|
||||
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t index a,b b 7 NULL 10 Using index
|
||||
1 PRIMARY t1 ref b b 3 test.t.b 2 Using index
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; FirstMatch(t)
|
||||
1 PRIMARY t1 ref b b 3 test.t.b 2 Using index; Start temporary
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; End temporary; Using join buffer (flat, BNL join)
|
||||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t.a 1 Using index
|
||||
SELECT a FROM t1 AS t, t2
|
||||
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
@ -740,8 +740,8 @@ SELECT a FROM t1 AS t, t2
|
||||
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t index a,b b 7 NULL 10 Using index
|
||||
1 PRIMARY t1 ref b b 3 test.t.b 2 Using index
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; FirstMatch(t)
|
||||
1 PRIMARY t1 ref b b 3 test.t.b 2 Using index; Start temporary
|
||||
1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; End temporary; Using join buffer (flat, BNL join)
|
||||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t.a 1 Using index
|
||||
SELECT a FROM t1 AS t, t2
|
||||
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
|
||||
|
Reference in New Issue
Block a user