[MDEV-3446] LP:901399 - Wrong result (extra row) with semijoin=ON, materialization=OFF, optimizer_prune_level=0 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: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query SELECT * produces an extra row on test data if it's run with materialization=OFF and otherwise default optimizer_switch values, while it returns the correct result set with materialization=ON (or with semijoin=OFF, or with loosescan=OFF). EXPLAIN with materialization=OFF (wrong result): 1 PRIMARY alias2 ALL NULL NULL NULL NULL 13 100.00 select `test`.`alias1`.`c` AS `c`,`test`.`alias2`.`c` AS `c` from `test`.`t1` `alias1` semi join (`test`.`t2` `alias3` join `test`.`t2` `alias4`) join `test`.`t1` `alias2` where ((`test`.`alias3`.`a` = `test`.`alias2`.`c`) and (`test`.`alias1`.`c` = `test`.`alias2`.`c`) and (`test`.`alias4`.`b` = `test`.`alias3`.`b`)) EXPLAIN with materialization=ON (correct result): 1 PRIMARY alias1 ALL NULL NULL NULL NULL 13 100.00 select `test`.`alias1`.`c` AS `c`,`test`.`alias2`.`c` AS `c` from `test`.`t1` `alias1` semi join (`test`.`t2` `alias3` join `test`.`t2` `alias4`) join `test`.`t1` `alias2` where ((`test`.`alias2`.`c` = `test`.`alias1`.`c`) and (`test`.`alias4`.`b` = `test`.`alias3`.`b`)) Minimal optimizer_switch: materialization=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=on,loosescan=on,materialization=off,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 Reproducible with MyISAM and InnoDB, but not Aria. Test case: SET optimizer_prune_level=0; CREATE TABLE t1 ( c INT ) ENGINE=MyISAM; SELECT *
bzr version-info Also reproducible on revno 3315 |
| Comments |
| Comment by Sergei Petrunia [ 2011-12-07 ] | ||||||||
|
Re: Wrong result (extra row) with semijoin=ON, materialization=OFF, optimizer_prune_level=0
-----
----- | ||||||||
| Comment by Sergei Petrunia [ 2011-12-08 ] | ||||||||
|
Re: Wrong result (extra row) with semijoin=ON, materialization=OFF, optimizer_prune_level=0 Here one can see the problem: table alias3 uses 'ALL' scan and LooseScan. This | ||||||||
| Comment by Sergei Petrunia [ 2011-12-08 ] | ||||||||
|
Re: Wrong result (extra row) with semijoin=ON, materialization=OFF, optimizer_prune_level=0 Here one can see the problem: table alias3 uses 'ALL' scan and LooseScan. This | ||||||||
| Comment by Elena Stepanova [ 2012-03-17 ] | ||||||||
|
Re: Wrong result (extra row) with semijoin=ON, materialization=OFF, optimizer_prune_level=0 | ||||||||
| Comment by Rasmus Johansson (Inactive) [ 2012-03-18 ] | ||||||||
|
Launchpad bug id: 901399 |