[MDEV-27492] DOUBLE_PREC_HB histogram has poor estimates for BIT columns Created: 2022-01-13 Updated: 2023-12-07 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | N/A |
| Fix Version/s: | 10.11 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
EDIT : The issue is actually not what is described in the report. See the comments!
The total count is 34 rows and the result set is 2 rows. Also reproducible with InnoDB, Aria. |
| Comments |
| Comment by Elena Stepanova [ 2022-01-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
See also MDEV-27493, it must be related in some way. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
The first column, a varchar(1), seems to be completely irrelevant. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2022-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
It participates in the where clause. Maybe it can be modified to eliminate it, I didn't succeed. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Interesting, when I remove conditions on a from the WHERE clause, I get it the other way around: JSON_HB is precise while DOUBLE_PREC_HB is not :
DOUBLE_PREC_HB:
JSON_HB:
| ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Running the original query:
Optimizer trace shows:
Note that it has no estimate for the
condition. That condition has selectivity of 11.76%. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
An idea about why DOUBLE_PREC_HB selectivity is wrong:
13715197108439488792 is BE562B1A99001918. min_value is wrong. Actual ordering:
| ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
... so, mysql.min_value and max_value are incorrect, and since DOUBLE_PREC_HB histogram uses them for computing estimates, the estimates are incorrect, too. |