Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5, 10.6, 10.11
-
None
Description
InnoDB is known to produce overly-optimistic index estimates for index lookups.
This was done intentionally, see this piece in ha_innobase::info_low:
/* Since MySQL seems to favor table scans |
too much over index searches, we pretend
|
index selectivity is 2 times better than
|
our estimate: */
|
|
rec_per_key_int = rec_per_key_int / 2;
|
However in some cases that can cause poor query plans.
in 11.0, this was removed by this commit:
commit 01c82173dd8b6ea627dec949dbc57dfcc94a656d
|
Author: Monty <monty@mariadb.org>
|
Date: Thu Jan 26 11:38:31 2023 +0200
|
|
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 MDEV is about adding a capability to remove the /2 in versions before 11.0