Skip to content

Instantly share code, notes, and snippets.

@napolux
Last active August 30, 2018 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save napolux/e2489c1de9a070f7e4d211c12b6c6afc to your computer and use it in GitHub Desktop.
Save napolux/e2489c1de9a070f7e4d211c12b6c6afc to your computer and use it in GitHub Desktop.
Print the size of redis keys in a readable way (I use it for sets)
#!/bin/sh
for SET in `redis-cli --scan --pattern 'set:*'`
do
printf "%s\t%s\n" $SET `redis-cli SCARD $SET`
done
# example output
# set:2454148031 33
# set:1497228031 1932
# set:524015031 418
# set:412600031 264
# set:635016031 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment