--source include/have_rocksdb.inc

CREATE TABLE `linktable` (
  `id1` bigint(20) unsigned NOT NULL DEFAULT '0',
  `id1_type` int(10) unsigned NOT NULL DEFAULT '0',
  `id2` bigint(20) unsigned NOT NULL DEFAULT '0',
  `id2_type` int(10) unsigned NOT NULL DEFAULT '0',
  `link_type` bigint(20) unsigned NOT NULL DEFAULT '0',
  `visibility` tinyint(3) NOT NULL DEFAULT '0',
  `data` varchar(255) NOT NULL DEFAULT '',
  `time` bigint(20) unsigned NOT NULL DEFAULT '0',
  `version` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (link_type, `id1`,`id2`) COMMENT 'cf_link_pk',
  KEY `id1_type` (`id1`,`link_type`,`visibility`,`time`,`id2`,`version`,`data`) COMMENT 'rev:cf_link_id1_type'
) ENGINE=RocksDB DEFAULT COLLATE=latin1_bin;
--disable_query_log
let $i = 1;
while ($i <= 10000) {
  let $insert = INSERT INTO linktable (id1, link_type, id2) values (1, 1, $i);
  inc $i;
  eval $insert;
}
--enable_query_log
set global rocksdb_force_flush_memtable_now=1;

insert into linktable (id1, link_type, id2) values (2, 1, 1);
insert into linktable (id1, link_type, id2) values (2, 1, 2);
insert into linktable (id1, link_type, id2) values (2, 1, 3);
insert into linktable (id1, link_type, id2) values (2, 1, 4);
insert into linktable (id1, link_type, id2) values (2, 1, 5);
insert into linktable (id1, link_type, id2) values (2, 1, 6);
insert into linktable (id1, link_type, id2) values (2, 1, 7);
insert into linktable (id1, link_type, id2) values (2, 1, 8);
insert into linktable (id1, link_type, id2) values (2, 1, 9);
insert into linktable (id1, link_type, id2) values (2, 1, 10);

--replace_column 9 #
explain select id1, id2, link_type, data from linktable force index(primary) where id1=2 and link_type=1 and (id2=1 or id2=2 or id2=3 or id2=4 or id2=5);

drop table linktable;
