@@ -20,16 +20,31 @@ id1 id2 link_type visibility data time version
select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
case when variable_value-@c > 0 then 'true' else 'false' end
true
# MariaDB: we don't have optimizer_force_index_for_range, but we can use EITS
# to get the query plan we want.
set @tmp_use_stat_tables= @@use_stat_tables;
set use_stat_tables='preferably';
analyze table linktable persistent for all;
Table Op Msg_type Msg_text
test.linktable analyze status Engine-independent statistics collected
test.linktable analyze status OK
flush tables;
explain select * from linktable;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE linktable ALL NULL NULL NULL NULL 10000
# This must use range(id1_type2), key_len=24
explain
select id1, id2, link_type, visibility, data, time, version from linktable
FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE linktable range id1_type2 id1_type2 24 NULL 1000 Using where; Using index
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
set @tmp_force_index_for_range=@@optimizer_force_index_for_range;
set optimizer_force_index_for_range=on;
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc;
id1 id2 link_type visibility data time version
100 100 1 1 100 100 100
select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
case when variable_value-@c > 0 then 'true' else 'false' end
true
set global optimizer_force_index_for_range=@tmp_force_index_for_range;
select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked';
select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc;