[MDEV-2622] LP:833572 - Wrong result with semijoin and a specific query plan Created: 2011-08-25 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: | Philip Stoev (Inactive) | Assignee: | Sergei Petrunia |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query: SELECT alias1.col_varchar_key FROM t2 AS alias1 , t3 AS alias2 , t1 AS alias3 WHERE alias3.col_int_nokey IN ( SELECT col_int_key FROM v1 AS SQ1_alias1 WHERE SQ1_alias1.col_varchar_key < alias3.col_varchar_nokey OR SQ1_alias1.col_int_key < alias2.pk ); returns 1 extra row when using the following plan: 1 PRIMARY C ref col_int_key,col_varchar_key col_int_key 4 test.alias3.col_int_nokey 3 Usually, some other plan is chosen and there is no way to force this particular plan. Dataset: CREATE TABLE t1 ( pk int(11) NOT NULL AUTO_INCREMENT, col_int_nokey int(11) NOT NULL, col_int_key int(11) NOT NULL, col_varchar_key varchar(1) NOT NULL,col_varchar_nokey varchar(1) NOT NULL, PRIMARY KEY (pk), KEY col_int_key (col_int_key), KEY col_varchar_key (col_varchar_key,col_int_key)) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1; bzr version-info: revision-id: <email address hidden> 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=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=off,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 |
| Comments |
| Comment by Sergei Petrunia [ 2011-09-04 ] |
|
Re: Wrong result with semijoin and a specific query plan 1 PRIMARY C ref col_int_key,col_varchar_key col_int_key 4 test.alias3.col_int_nokey 3 has a pecularity: line#3: ... alias2 ... End temporary; Did the query plan really have "End temporary" before the "Start temporary" ? |
| Comment by Philip Stoev (Inactive) [ 2011-09-04 ] |
|
Re: Wrong result with semijoin and a specific query plan If it is not possible to reproduce this join order in the debugger, I am OK with deferring this bug until it happens again. If it is incorrect for "End temporary" to come before "Start temporary", please add an assertion that detects this situation. |
| Comment by Philip Stoev (Inactive) [ 2011-09-04 ] |
|
I looked at the original log and yes, start temporary appears after end temporary. I am attaching the log. The issue described starts on line 317. If it is not possible to reproduce this join order in the debugger, I am OK with deferring this bug until it happens again. If it is incorrect for "End temporary" to come before "Start temporary", please add an assertion that detects this situation. |
| Comment by Philip Stoev (Inactive) [ 2011-09-08 ] |
|
Re: Wrong result with semijoin and a specific query plan |
| Comment by Philip Stoev (Inactive) [ 2011-09-08 ] |
|
Re: Wrong result with semijoin and a specific query plan |
| Comment by Philip Stoev (Inactive) [ 2011-09-08 ] |
|
Original dataset |
| Comment by Sergei Petrunia [ 2011-09-08 ] |
|
Re: Wrong result with semijoin and a specific query plan |
| Comment by Sergei Petrunia [ 2011-09-08 ] |
|
Re: Wrong result with semijoin and a specific query plan |
| Comment by Rasmus Johansson (Inactive) [ 2011-09-08 ] |
|
Launchpad bug id: 833572 |