[MDEV-5980] EITS: if condition is used for REF access, its selectivity is still in filtered% Created: 2014-03-29 Updated: 2014-04-28 Resolved: 2014-04-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.9 |
| Fix Version/s: | 10.0.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | eits | ||
| Description |
|
This is ok.
This is not ok. "key1=2" is used for ref access. However, its selectivity is still present in "filtered%". Ref access is employed when a condition is very selective, counting its selectivity twice will cause gross under-estimation of output cardinality. |
| Comments |
| Comment by Sergei Petrunia [ 2014-03-31 ] | ||||||||||||||||||||||||||||||||||
We should recongize it as an equality that was bound by ref and so discount its Idea: keep array of induced selectivity table->added_selectivity[field_no] = 0.123456 and if $field_no is used for ref access, than it's not contributing to Q: what to do about range accesses that span multiple key parts? It's not | ||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-04-01 ] | ||||||||||||||||||||||||||||||||||
|
Modified the testcase a little bit so that data distribution is not uniform:
Now, will debug this query:
== calculate_cond_selectivity_for_table() == == table_cond_selectivity == double sel= s->table->cond_selectivity; // = 0.05 Eventually it runs this code:
However, field->cond_selectivity=1 there (because we've used range access The rest of the function (including table_multi_eq_cond_selectivity() call) doesn't modify 'sel'. sel remains 0.05
| ||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-04-21 ] | ||||||||||||||||||||||||||||||||||
|
Patch submitted for review |