[MDEV-26728] Histogram may return selectivity > 1.0 Created: 2021-09-30 Updated: 2022-08-04 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6 |
| Fix Version/s: | 10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Michael Widenius |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
I've hit this example when investigating Consider this testcase:
The trace will show:
Note this part:
this is because this call:
returns 143 rows, while the table has 128 rows (and the table statistics says so, too). We can see below that the incorrect selectivity doesn't spread:
. This is thanks to these lines:
Note the table_field->cond_selectivity < 1.0 condition. However, field->cond_selectivity still has the value that's greater than 1, which looks dangerous. |
| Comments |
| Comment by Michael Widenius [ 2021-09-30 ] |
|
This is already fixed in my 10.7 tree where I am correcting all things related with selectivity calcluations to ensure that selectivity is always between 0 and 1 |