Rocksdb_approximate_sizes_cf returns zero size

Hi,

RockDB ver: 6.14.6
RocksDB include more than 1000 items of 5k each.

Using rocksdb_approximate_sizes_cf API , which returns zero size ?!
Also didn’t find any documentation related to the size granularity (bytes,kb,mb …) ?

Thanks a lot , Shaul

The approximate size does not count the size of the mem-tables that was not flushed yet … you can call a manual flush if you want or else call the method GetApproximateMemTableStats (in c++)

1 Like

Shaul replied:
You are correct adding flush before checking the size returns with correct size.
However I can’t add flush just because I want to check the size.
I’m using c.h API which don’t include GetApproximateMemTableStats (and not able to move to db.h) , is there a way to get both in memory and on disc total size ?

hey Shaul, i think you can use rocksdb_approximate_memory_usage_create which returns:

struct rocksdb_memory_usage_t {
uint64_t mem_table_total;
uint64_t mem_table_unflushed;
uint64_t mem_table_readers_total;
uint64_t cache_total;
};
and the rocksdb_approximate_sizes_cf for the data which is on disk.

1 Like