[MDEV-3147] LP:901478 - Wrong result (missing row) with join_cache_level>=4, firstmatch=OFF, ORDER BY, Aria Created: 2011-12-07 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query SELECT * FROM t1, t2 produces a wrong result (with one row in t1 and N rows in t2, returns only one row instead of N) if it's run with firstmatch=OFF and join_cache_level>=4. Only reproducible if t2 is Aria and t1 is either Aria or MyISAM. I failed to see any difference between EXPLAIN output for join_cache_level=1 vs 4, but I will put both here anyway (first two outputs below). EXPLAIN output with join_cache_level=4, firstmatch=OFF (wrong result) 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 Using filesort select 'x' AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` semi join (`test`.`t1` join `test`.`t2`) join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`c`) order by `test`.`t2`.`b` EXPLAIN output with join_cache_level=1, firstmatch=OFF (correct result) 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 Using filesort select 'x' AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` semi join (`test`.`t1` join `test`.`t2`) join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`c`) order by `test`.`t2`.`b` EXPLAIN output with join_cache_level=1, firstmatch=ON (correct result) 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 Using filesort select 'x' AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` semi join (`test`.`t1` join `test`.`t2`) join `test`.`t2` where (`test`.`t2`.`c` = `test`.`t2`.`c`) order by `test`.`t2`.`b` Minimal optimizer_switch: firstmatch=off Full optimizer_switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=off,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on Test case: SET optimizer_switch='firstmatch=off'; CREATE TABLE t1 ( a CHAR(1) ) ENGINE=Aria; SELECT * FROM t1, t2
|
| Comments |
| Comment by Elena Stepanova [ 2011-12-09 ] |
|
Re: Wrong result (missing row) with join_cache_level>=4, firstmatch=OFF, ORDER BY, Aria |
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] |
|
Launchpad bug id: 901478 |