Skip to content

Commit

Permalink
MariaDB#11: Column families for RocksDB-SE
Browse files Browse the repository at this point in the history
- Basic support for Column Families (writes/reads go the right column
  family).
- CFs are specified per-index in the index comment:
  INDEX (col1,col2) COMMENT 'cf_name'
  • Loading branch information
spetrunia committed Sep 7, 2014
1 parent 21b4f83 commit 453318f
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 40 deletions.
52 changes: 52 additions & 0 deletions mysql-test/r/rocksdb.result
Original file line number Diff line number Diff line change
Expand Up @@ -1347,3 +1347,55 @@ select * from t1 where id1 = 3;
id1 id2 link_type visibility data time version
3 3 3 1 3 3 3
drop table t0,t1;
#
# Test column families
#
create table t1 (
pk int primary key,
col1 int,
col2 int,
key(col1) comment 'cf3',
key(col2) comment 'cf4'
) engine=rocksdb;
insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
explain
select * from t1 where col1=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref col1 col1 5 const 10 NULL
select * from t1 where col1=2;
pk col1 col2
2 2 2
explain
select * from t1 where col2=3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref col2 col2 5 const 10 NULL
select * from t1 where col2=3;
pk col1 col2
3 3 3
select * from t1 where pk=4;
pk col1 col2
4 4 4
drop table t1;
#
# Try primary key in a non-default CF:
#
create table t1 (
pk int,
col1 int,
col2 int,
key(col1) comment 'cf3',
key(col2) comment 'cf4',
primary key (pk) comment 'cf5'
) engine=rocksdb;
insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);
explain
select * from t1 where col1=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref col1 col1 5 const 10 NULL
select * from t1 where col1=2;
pk col1 col2
2 2 2
select * from t1 where pk=4;
pk col1 col2
4 4 4
drop table t1;
47 changes: 47 additions & 0 deletions mysql-test/t/rocksdb.test
Original file line number Diff line number Diff line change
Expand Up @@ -1190,3 +1190,50 @@ select * from t1 where id1 = 3;

drop table t0,t1;

--echo #
--echo # Test column families
--echo #

create table t1 (
pk int primary key,
col1 int,
col2 int,
key(col1) comment 'cf3',
key(col2) comment 'cf4'
) engine=rocksdb;

insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);

explain
select * from t1 where col1=2;
select * from t1 where col1=2;

explain
select * from t1 where col2=3;
select * from t1 where col2=3;

select * from t1 where pk=4;

drop table t1;

--echo #
--echo # Try primary key in a non-default CF:
--echo #
create table t1 (
pk int,
col1 int,
col2 int,
key(col1) comment 'cf3',
key(col2) comment 'cf4',
primary key (pk) comment 'cf5'
) engine=rocksdb;
insert into t1 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5);

explain
select * from t1 where col1=2;
select * from t1 where col1=2;

select * from t1 where pk=4;


drop table t1;
Loading

0 comments on commit 453318f

Please sign in to comment.