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 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
returns
a b
d xdmbdkpjda
f Pennsylvan
when executed with ICP in maria-5.3-icp and
a b
d xdmbdkpjda
otherwise. The table contains a string "Pennsylvan" which is a subset of "Pennsylvania"
EXPLAIN with ICP: note that ICP is not shown anywhere:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range b b 13 NULL 2 100.00 Using filesort
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`b` <> 'Texas') and (`test`.`t1`.`b` between 'wy' nd 'y')) or (`test`.`t1`.`b` = 'Pennsylvania')) order by `test`.`t1`.`a`
EXPLAIN without ICP:
EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range b b 13 NULL 2 100.00 Using where; Using filesort
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`b` <> 'Texas') and (`test`.`t1`.`b` between 'wy' nd 'y')) or (`test`.`t1`.`b` = 'Pennsylvania')) order by `test`.`t1`.`a`
minimal switch:index_condition_pushdown=ON
full 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,deried_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_tble_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_cche_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
bzr version-info
revision-id: <email address hidden>
date: 2011-11-02 01:22:11 -0700
build-date: 2011-11-02 13:53:50 +0200
revno: 3267
branch-nick: maria-5.3-icp
test case:
CREATE TABLE t1 ( a varchar(64), b varchar(10), KEY (a), KEY (b)) ;
INSERT INTO t1 VALUES ('Ohio','Iowa'),('k','d'),('bdkpj','mbdkpjdanp'),('d','xdmbdkpjda'),('fkxdmbdkpjdanpje','o'),('f','Pennsylvan'),('Virginia','ei');
SET SESSION optimizer_switch='index_condition_pushdown=on';
SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
SET SESSION optimizer_switch='index_condition_pushdown=off';
SELECT * FROM t1 WHERE NOT ( b = 'Texas' ) AND b BETWEEN 'wy' AND 'y' OR ( b = 'Pennsylvania' ) ORDER BY a;
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Wrong result with icp, ranges in maria-5.3-icp
See also https://bugs.launchpad.net/maria/+bug/884175