Skip to main content

Apache Kvrocks™ FAQs

Question: How do I get keys num in Kvrocks?

Kvrocks doesn't store the key number directly. It needs to scan the DB and then retrieve the key number by using the dbsize scan command.> dbsize scan
OK> info keyspace
# Keyspace
# Last scan db time: Thu Mar 24 06:38:39 2022

Question: Why didn't the Kvrocks disk size change after the FLUSHALL/FLUSHDB command was executed?

To prevent the FLUSHALL/FLUSHDB command blocking the request, Kvrocks uses the RocksDB DeleteRange API to implement the flush command, which only marks the key range as deleted without reclaiming the disk space at once. Those deleted keys are recycled when the background compaction is triggered. You can use the compact command to free up the disk space after flushing.> flushall

# Send the compact command to release the disk space> compact

Question: Why Kvrocks scan return a string iterator instead of a number

For the historical design reason, Kvrocks uses the string iterator to return the scan result. But after PR #1489(since v2.5.0), the scan command can return a number iterator by enabling the configuration: redis-cursor-compatible. You can also enable it in-flight by using the config set command.> config set redis-cursor-compatible yes