diff --git a/mysql-test/suite/rocksdb/r/rocksdb_icp.result b/mysql-test/suite/rocksdb/r/rocksdb_icp.result index 80aec1b29578..f3342c815938 100644 --- a/mysql-test/suite/rocksdb/r/rocksdb_icp.result +++ b/mysql-test/suite/rocksdb/r/rocksdb_icp.result @@ -191,3 +191,37 @@ ROWS_INDEX_NEXT-@rin 0 drop table t4; drop procedure save_read_stats; drop procedure get_read_stats; +# +# Issue #67: Inefficient index condition pushdown +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +pk int not null primary key, +key1 bigint(20) unsigned, +col1 int, +key (key1) +) engine=rocksdb; +insert into t1 +select +A.a+10*B.a+100*C.a, +A.a+10*B.a+100*C.a, +1234 +from t0 A, t0 B, t0 C; +set @count=0; +explain +select * from t1 where key1=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref key1 key1 9 const 10 Using index condition +set @count_diff =(select (value - @count) from information_schema.rocksdb_perf_context +where table_schema=database() and table_name='t1' and stat_type='INTERNAL_KEY_SKIPPED_COUNT'); +select * from t1 where key1=1; +pk key1 col1 +1 1 1234 +set @count_diff =(select (value - @count) from information_schema.rocksdb_perf_context +where table_schema=database() and table_name='t1' and stat_type='INTERNAL_KEY_SKIPPED_COUNT'); +# The following must be =1, or in any case not 999: +select @count_diff as "INTERNAL_KEY_SKIPPED_COUNT increment"; +INTERNAL_KEY_SKIPPED_COUNT increment +1 +drop table t0,t1; diff --git a/mysql-test/suite/rocksdb/t/rocksdb_icp.test b/mysql-test/suite/rocksdb/t/rocksdb_icp.test index 34ee17a1cb9b..325c04d4807d 100644 --- a/mysql-test/suite/rocksdb/t/rocksdb_icp.test +++ b/mysql-test/suite/rocksdb/t/rocksdb_icp.test @@ -3,3 +3,39 @@ let $cf_name=cf1; --source suite/rocksdb/t/rocksdb_icp.inc +--echo # +--echo # Issue #67: Inefficient index condition pushdown +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 ( + pk int not null primary key, + key1 bigint(20) unsigned, + col1 int, + key (key1) +) engine=rocksdb; + +insert into t1 +select + A.a+10*B.a+100*C.a, + A.a+10*B.a+100*C.a, + 1234 +from t0 A, t0 B, t0 C; + +set @count=0; +let $save_query= +set @count_diff =(select (value - @count) from information_schema.rocksdb_perf_context + where table_schema=database() and table_name='t1' and stat_type='INTERNAL_KEY_SKIPPED_COUNT'); + +explain +select * from t1 where key1=1; + +eval $save_query; +select * from t1 where key1=1; +eval $save_query; +--echo # The following must be =1, or in any case not 999: +select @count_diff as "INTERNAL_KEY_SKIPPED_COUNT increment"; + +drop table t0,t1; +