Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the size of a single key in Redis

How can I know the size (in KB) of a particular key in redis?
I'm aware of info memory command, but it gives combined size of Redis instance, not for a single key.

like image 803
GorvGoyl Avatar asked Dec 05 '22 01:12

GorvGoyl


1 Answers

I know this is an old question but, just for the record, Redis implemented a memory usage <key> command since version 4.0.0.

The output is the amount of bytes required to store the key in RAM.

Reference: https://redis.io/commands/memory-usage ‏

like image 67
bruno.zambiazi Avatar answered Feb 07 '23 09:02

bruno.zambiazi