1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Removed /2 of InnoDB ref_per_key[] estimates

The original code was there to favor index search over table scan.
This is not needed anymore as the cost calculations for table scans
and index lookups are now more exact.
This commit is contained in:
Monty
2023-01-26 11:38:31 +02:00
parent 87507bbb4f
commit 01c82173dd
13 changed files with 64 additions and 33 deletions

View File

@ -560,6 +560,7 @@ id select_type table type possible_keys key key_len ref rows Extra
#
# MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
#
insert into t2 select seq,seq,seq from seq_10000_to_11000;
alter table t2 add key2 int;
update t2 set key2=key1;
alter table t2 add key(key2);
@ -580,6 +581,29 @@ t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL #
2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a # Using where; Using filesort
select
(SELECT
concat(id, '-', key1, '-', col1)
FROM t2
WHERE t2.key1 = t1.a
ORDER BY t2.key2 ASC LIMIT 1)
from
t1;
(SELECT
concat(id, '-', key1, '-', col1)
FROM t2
WHERE t2.key1 = t1.a
ORDER BY t2.key2 ASC LIMIT 1)
100-0-123456
101-1-123456
102-2-123456
103-3-123456
104-4-123456
105-5-123456
106-6-123456
107-7-123456
108-8-123456
109-9-123456
drop table t1,t2;
#
# MDEV-12931: semi-join in ON expression of STRAIGHT_JOIN