[MDEV-6442] Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, InnoDB, multi-part key, no info in stat tables Created: 2014-07-13 Updated: 2014-10-06 Resolved: 2014-10-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0.12 |
| Fix Version/s: | 10.0.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | eits, optimizer | ||
| Issue Links: |
|
||||||||
| Description |
|
The problem appeared on 10.0 tree with the following revision:
Stack trace from:
EXPLAIN also crashes. |
| Comments |
| Comment by Sergei Petrunia [ 2014-07-30 ] | |||||||||||
|
The cause is that table_cond_selectivity() produces this:
for idx=2, table->alias= t1_2 Actually, the problem starts here:
and also we have
| |||||||||||
| Comment by Sergei Petrunia [ 2014-07-30 ] | |||||||||||
|
And the reason we get that is as follows: Range optimizer finds the range t1_2.b='t' | |||||||||||
| Comment by Sergei Petrunia [ 2014-07-30 ] | |||||||||||
|
We have a Column_statistics object that has all zeros:
And it is set to be like that here:
| |||||||||||
| Comment by Sergei Petrunia [ 2014-07-30 ] | |||||||||||
|
The bug is caused by two factor: I would say that #1 is not really a bug, because avg_frequency() >= 1 by definition. The problem is #2. Perhaps, get_avg_frequency()=0 mean "No data is available"? It's not documented anywhere. | |||||||||||
| Comment by Sergei Petrunia [ 2014-07-30 ] | |||||||||||
|
Discussed with Igor. Indeed, get_avg_frequency()=0 means "No data is available". The optimizer code should give special treatment to the case where get_avg_frequency()=0 . It's not only about avoiding divisions by zero, it is also about not producing very wrong estimates. | |||||||||||
| Comment by Elena Stepanova [ 2014-08-01 ] | |||||||||||
|
I have a somewhat different test case, where I do run ANALYZE, but then add a key and after that run SELECT without re-running ANALYZE. That is, the flow is like this:
After that I get the same assertion failure. Can I consider it a variation of the same problem, or does it need to be analyzed separately? | |||||||||||
| Comment by Sergei Petrunia [ 2014-08-01 ] | |||||||||||
|
elenst, please file a separate issue about this. The above problem is not using index statistics, it seems like you're looking at a similar but a separate issue. | |||||||||||
| Comment by Elena Stepanova [ 2014-08-01 ] | |||||||||||
|
Filed as |