Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
The following query
SELECT * FROM t1 AS a1 JOIN v1 AS a2 WHERE a1.f2 = a2.f4 AND a1.f4 = a2.f4;
does not return all matching rows when executed with derived_with_keys=on. Notice that the WHERE predicate references a2.f4 twice.
test case:
CREATE TABLE t1 (f2 int, f4 int);
INSERT INTO t1 VALUES (0,0),(0,0),(3,0),(1,0);
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT f2, f4 FROM t1 ;
SET SESSION optimizer_switch='derived_with_keys=on';
SELECT * FROM t1 AS a1 JOIN v1 AS a2 WHERE a1.f2 = a2.f4 AND a1.f4 = a2.f4;
SET SESSION optimizer_switch='derived_with_keys=off';
SELECT * FROM t1 AS a1 JOIN v1 AS a2 WHERE a1.f2 = a2.f4 AND a1.f4 = a2.f4;
explain:
-----------------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
-----------------------------------------------------------------------------+
| 1 | PRIMARY | a1 | ALL | NULL | NULL | NULL | NULL | 4 | Using where |
| 1 | PRIMARY | <derived2> | ref | key0 | key0 | 5 | v_b.a1.f2 | 2 | |
| 2 | DERIVED | t1 | ALL | NULL | NULL | NULL | NULL | 4 |
minimal optimizer switch: derived_with_keys=on;
total 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=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=off,mrr_sort_keys=on,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=on,table_elimination=on
bzr version-info
revision-id: <email address hidden>
date: 2011-07-06 10:30:51 +0400
build-date: 2011-07-06 14:24:26 +0300
revno: 3085
branch-nick: maria-5.3
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Launchpad bug id: 806431