[MDEV-7893] table_elimination works wrong with on computed expression and compound unique key Created: 2015-04-01 Updated: 2015-10-07 Resolved: 2015-04-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.3.13, 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.43 |
| Type: | Bug | Priority: | Major |
| Reporter: | Gleb Golubitsky | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | table-elimination, verified | ||
| Environment: |
Debian Linux Jessie (amd64) |
||
| Issue Links: |
|
||||||||
| Description |
|
Hey all, Soon after switching my project from MySQL 5.5 to MariaDB 10.0 I found an issue in optimizer. Please find below minimum sample reproducing an issue:
Schema may seem silly but it's just because I stripped away on unrelated columns.
Here is ACTUAL behavior:
And now EXPECTED behaviour:
If you require any additional information - please let me know. |
| Comments |
| Comment by Elena Stepanova [ 2015-04-01 ] |
|
Thanks for the report and the test case. Reproducible as described. |
| Comment by Sergei Petrunia [ 2015-04-21 ] |
|
See also: |
| Comment by Sergei Petrunia [ 2015-04-23 ] |
|
Analysis: the problem is caused by Table Elimination optimization. It eliminates table T, despite that the select list has `T`.`Voted` as `Voted` Debugging, I can see that it is an Item_direct_view_ref() object, which has item->used_tables()=0. Because of that, table elimination assumes that nobody cares about whether table T has null-complemented row or not. |
| Comment by Sergei Petrunia [ 2015-04-23 ] |
|
|
| Comment by Sergei Petrunia [ 2015-04-23 ] |
|
Pushed a testcase. |
| Comment by Gleb Golubitsky [ 2015-04-23 ] |
|
Thanks for your fix. But what about 10.x branch(es)? Will this bug be fixed in those branches as well? |
| Comment by Sergei Petrunia [ 2015-04-24 ] |
|
Yes. There will be a 5.5->10.0 merge before the next 10.0.x release (10.0.18). The same goes for 10.1 |