Report Index Size per Column Family
This document describes the new index size reporting per column family introduced in Speedb 2.3.0.
Last updated
Was this helpful?
Was this helpful?
void PrintCacheStats( DBImpl* db, const std::shared_ptr<Cache>& cache){
if (std::string(cache->Name()) != "LRUCache") {
// The feature is only supported for LRU-Cache
return;
}
auto cf_handle = db->DefaultColumnFamily();
std::map<std::string, std::string> cf_values;
db->GetMapProperty(cf_handle, DB::Properties::kBlockCacheCfStats, &cf_values);
std::cout << "Block Cache Stats for the " << cf_values[BlockCacheCfStatsMapKeys::CfName()] << " column-family:\n";
std::cout << "Cache Id:" << cf_values[BlockCacheCfStatsMapKeys::CacheId()] << '\n';
std::cout << "Data Size:" << cf_values[BlockCacheCfStatsMapKeys::UsedBytes(CacheEntryRole::kDataBlock)] << '\n';
std::cout << "Index Size:" << cf_values[BlockCacheCfStatsMapKeys::UsedBytes(CacheEntryRole::kIndexBlock)] << '\n';
std::cout << "Filter Size:" << cf_values[BlockCacheCfStatsMapKeys::UsedBytes(CacheEntryRole::kFilterBlock)] << '\n';
}