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

@ -1,5 +1,6 @@
-- source include/no_valgrind_without_big.inc
-- source include/have_innodb.inc
-- source include/have_sequence.inc
# Note: the tests uses only non-semijoin subqueries so semi-join switch
# settings are not relevant.
@ -568,6 +569,11 @@ from
--echo # MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
--echo #
# Table t2 has 100 equal values / key value, which causes it to prefer index scan instead of ref
# Fix it by adding more different values to key1
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);
@ -583,6 +589,14 @@ explain select
ORDER BY t2.key2 ASC LIMIT 1)
from
t1;
select
(SELECT
concat(id, '-', key1, '-', col1)
FROM t2
WHERE t2.key1 = t1.a
ORDER BY t2.key2 ASC LIMIT 1)
from
t1;
drop table t1,t2;