Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many keys can be deleted in a single redis del command?

Tags:

redis

I want to delete multiple redis keys using a single delete command on redis client. Is there any limit in the number of keys to be deleted?

i will be using del key1 key2 ....

like image 264
santhosh rocks Avatar asked Sep 12 '25 12:09

santhosh rocks


1 Answers

There's no hard limit on the number of keys, but the query buffer limit does provide a bound. Connections are closed when the buffer hits 1 GB, so practically speaking this is somewhat difficult to hit.

Docs: https://redis.io/topics/clients

However! You may want to take into consideration that Redis is single-threaded: a time-consuming command will block all other commands until completed. Depending on your use-case this may make a good case for "chunking" up your deletes into groups of, say, 1000 at a time, because it allows other commands to squeeze in between. (Whether or not this is tolerable is something you'll need to determine based on your specific scenario.)

like image 197
chris Avatar answered Sep 15 '25 22:09

chris