Length of Keys - Performance Concerns?

Your key (16 bytes UID + 8 byte + more) will escape to the heap since it will be passed to badger. Since byte slice is just a header to an underlying array, there will be only one copy of your actual key in heap but multiple copies of the slice header (3 word size).

Badger will store the actual key to the SST and value log. For larger values (more than options.ValueThreshold), the SST will store the key and pointer to the value in the vlog file.

2 Likes