Skip to content

Instantly share code, notes, and snippets.

@michael-grunder
Created February 27, 2014 19:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michael-grunder/9257326 to your computer and use it in GitHub Desktop.
Save michael-grunder/9257326 to your computer and use it in GitHub Desktop.
redis-cli --bigkeys (new)
➜ src git:(cli_improved_bigkeys) ✗ time ./redis-cli --bigkeys
# Scanning the entire keyspace to find biggest keys as well as
# average sizes per key type. You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).
[00.00%] Biggest hash found so far '530f8e1db5876:1:hash:146377' with 44 fields
[00.00%] Biggest list found so far '530f8ed14a8b0:17:list:269378' with 193 items
[00.00%] Biggest set found so far '530f8da537194:83:set:63043' with 432 members
[00.00%] Biggest string found so far '530f8f2de7045:95:string:333887' with 345 bytes
[00.00%] Biggest hash found so far '530f8d72ae154:17:hash:28263' with 277 fields
[00.00%] Biggest string found so far '530f8ede62d15:38:string:278735' with 391 bytes
[00.00%] Biggest list found so far '530f8edb5c815:58:list:276530' with 446 items
[00.00%] Biggest string found so far '530f8e3c9b68d:90:string:167609' with 419 bytes
[00.00%] Biggest set found so far '530f8e7c45d5a:36:set:211049' with 451 members
[00.00%] Biggest hash found so far '530f8e506c235:57:hash:180848' with 309 fields
[00.00%] Biggest hash found so far '530f8d6e3a542:2:hash:25067' with 401 fields
[00.00%] Biggest zset found so far '530f8e782b6b5:30:zset:208542' with 299 members
[00.01%] Biggest hash found so far '530f8e7dbd77c:69:hash:212084' with 499 fields
[00.01%] Biggest zset found so far '530f8e475c5e6:63:zset:174318' with 327 members
[00.01%] Biggest list found so far '530f8ddbd3cb9:93:list:101298' with 472 items
[00.01%] Biggest zset found so far '530f8d58a2bea:80:zset:10089' with 374 members
[00.01%] Biggest zset found so far '530f8ecb62288:33:zset:265311' with 439 members
[00.02%] Biggest string found so far '530f8f19581e0:75:string:319575' with 467 bytes
[00.04%] Biggest zset found so far '530f8f1c507ac:49:zset:321780' with 484 members
[00.05%] Biggest set found so far '530f8f29637e0:46:set:330467' with 458 members
[00.06%] Biggest string found so far '530f8e3e12c2b:78:string:168164' with 480 bytes
[00.07%] Biggest set found so far '530f8e399f637:90:set:165455' with 485 members
[00.07%] Biggest string found so far '530f8ec6f1e21:2:string:262723' with 496 bytes
[00.10%] Biggest list found so far '530f8e562bf1b:79:list:184913' with 479 items
[00.13%] Biggest set found so far '530f8e5e47e6a:79:set:190044' with 488 members
[00.13%] Biggest set found so far '530f8d656a875:15:set:19143' with 496 members
[00.18%] Biggest list found so far '530f8f17cc8bb:95:list:318667' with 482 items
[00.19%] Biggest string found so far '530f8dc7c7b3b:39:string:87929' with 500 bytes
[00.23%] Biggest list found so far '530f8d9cbafc0:25:list:57223' with 488 items
[00.24%] Biggest list found so far '530f8d897badc:50:list:44301' with 495 items
[00.32%] Biggest zset found so far '530f8e601115e:12:zset:191532' with 492 members
[00.39%] Biggest zset found so far '530f8e168d8a2:3:zset:141710' with 494 members
[00.39%] Biggest zset found so far '530f8e1227320:90:zset:138565' with 497 members
[00.41%] Biggest set found so far '530f8dd325a93:90:set:95812' with 497 members
[00.48%] Biggest set found so far '530f8e24e5c34:78:set:151303' with 498 members
[00.48%] Biggest list found so far '530f8ecfa3d62:76:list:268116' with 498 items
[00.52%] Biggest list found so far '530f8eb5a48bd:4:list:250746' with 499 items
[00.55%] Biggest hash found so far '530f8d619a0af:86:hash:16911' with 500 fields
[00.62%] Biggest list found so far '530f8d5a17b26:9:list:11211' with 500 items
[00.96%] Biggest zset found so far '530f8d72dd70e:43:zset:28760' with 498 members
[01.06%] Biggest set found so far '530f8da856e1e:75:set:65939' with 500 members
[01.45%] Biggest zset found so far '530f8d4a9ce31:45:zset:315' with 500 members
-------- summary -------
Sampled 343799 keys in the keyspace!
Total key length in bytes is 9556361 (avg len 27.80)
Biggest string found '530f8dc7c7b3b:39:string:87929' has 500 bytes
Biggest list found '530f8d5a17b26:9:list:11211' has 500 items
Biggest set found '530f8da856e1e:75:set:65939' has 500 members
Biggest hash found '530f8d619a0af:86:hash:16911' has 500 fields
Biggest zset found '530f8d4a9ce31:45:zset:315' has 500 members
68559 strings with 17136672 bytes (19.94% of keys, avg size 249.96)
68986 lists with 17326343 items (20.07% of keys, avg size 251.16)
68803 sets with 17236635 members (20.01% of keys, avg size 250.52)
68622 hashs with 17272144 fields (19.96% of keys, avg size 251.70)
68829 zsets with 17241902 members (20.02% of keys, avg size 250.50)
./redis-cli --bigkeys 0.74s user 0.72s system 47% cpu 3.105 total
@beerappamn
Copy link

bigkeys means , keys which all are taking more disk usage ?
if yes , how we can reduce the size ?

@AbhishekChauhanTriangle
Copy link

Does it give bigkeys of all databases/?

@ricardona
Copy link

Does it give bigkeys of all databases/?

No, use -n to choose the database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment