diff options
-rw-r--r-- | storage/rocksdb/ha_rocksdb.cc | 5 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 9f73b95cb4d..a940e451f75 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -10755,6 +10755,11 @@ int ha_rocksdb::info(uint flag) { stats.data_file_length += m_table_handler->m_mtcache_size; } + // Do like InnoDB does. stats.records=0 confuses the optimizer + if (stats.records == 0 && !(flag & (HA_STATUS_TIME | HA_STATUS_OPEN))) { + stats.records++; + } + if (rocksdb_debug_optimizer_n_rows > 0) stats.records = rocksdb_debug_optimizer_n_rows; } diff --git a/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result b/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result index 9bbbdec4794..228e1313e74 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/records_in_range.result @@ -183,7 +183,7 @@ insert into linktable values (1,1,4,1,1,1,1,1,1); set global rocksdb_force_flush_memtable_now = true; explain select id1, id2, link_type, visibility, data, time, version from linktable where id1 = 1 and link_type = 1 and id2 in (1, 2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE linktable range PRIMARY,id1_type PRIMARY 24 NULL 2 Using where +1 SIMPLE linktable ref PRIMARY,id1_type PRIMARY 16 const,const 2 Using where drop table linktable; CREATE TABLE `linktable` ( `id1` bigint(20) unsigned NOT NULL DEFAULT '0', @@ -205,6 +205,6 @@ insert into linktable values (1,1,4,1,1,1,1,1,1); set global rocksdb_force_flush_memtable_now = true; explain select id1, id2, link_type, visibility, data, time, version from linktable where id1 = 1 and link_type = 1 and id2 in (1, 2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE linktable range PRIMARY,id1_type PRIMARY 24 NULL 2 Using where +1 SIMPLE linktable ref PRIMARY,id1_type PRIMARY 16 const,const 2 Using where drop table linktable; DROP TABLE t1; |