[MDEV-580] LP:992942 - Wrong result with enabled index condition pushdown and disabled subquery materialization. Created: 2012-05-01 Updated: 2014-04-13 Resolved: 2014-04-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Igor Babaev | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following sequence of commands gives a wrong query result in MariaDB 5.3/5.5:
The correct answer for the query is returned with these settings:
And with these settings also we have the correct answer
(See also bug#12667154 in mysql-5.6.5) |
| Comments |
| Comment by Sergei Petrunia [ 2012-05-25 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization.
this is clearly not what was intended. However, the effect is only performance, the query produces correct result. MariaDB 5.3/ MySQL 5.6 add IndexConditionPushdown, which is not cleaned up correctly and causes wrong query result. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2012-06-22 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2012-06-22 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization. Let's assume there is a subquery that uses filesort() on its first table. This subquery will execute as follows: and suppose the subquery is correlated, so we'll need to execute it multiple times. The problem here is as follows:
Re-initializing for quick select is easy: we can remember the index #, and whether index_only should be ON. (Need to check also whether table->read_map should be/is re-initialized). There is a problem with re-initialization for ICP. Pushed index condition is not saved anywhere. There is no way to remember what was pushed and re-push it later. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2012-06-22 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2012-06-24 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization. Besides that, we also need to take into account that
| ||||||||||||||||
| Comment by Sergei Petrunia [ 2012-07-24 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2012-08-01 ] | ||||||||||||||||
|
Re: Wrong result with enabled index condition pushdown and disabled subquery materialization. | ||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2012-08-28 ] | ||||||||||||||||
|
Launchpad bug id: 992942 | ||||||||||||||||
| Comment by Sergei Petrunia [ 2013-01-25 ] | ||||||||||||||||
|
Currently:
I guess, MySQL has fixed it from their side, and we've got a fix merged from them. | ||||||||||||||||
| Comment by Sergei Petrunia [ 2013-01-25 ] | ||||||||||||||||
|
Perhaps, we could unify the fixes. But if this bug is not repeatable, it cannot be a stopper for 5.5.29. | ||||||||||||||||
| Comment by Elena Stepanova [ 2014-04-13 ] | ||||||||||||||||
|
The bug disappeared from 5.3 tree since the following revision:
Thus closing as fixed in 5.3.10, 5.5.28, 10.0.0. |