![]() Here we collect awesome macOS software in various categories. While this may still be expensive to retrieve the entire set of keys, it can be done in small batches, thus allowing other requests to be serviced in between iterations. Now we have become very big and different from the original idea. That’s not what Redis is for.īut if you do ever need to inspect your Redis keys on the server, at least follow the advice in the documentation and use SCAN instead. My recommendation to developers using Redis is to keep good documentation of your keys, so you won’t need any Redis command to tell you what keys are in the database. So do take care when using Redis Desktop Manager in such environments. However, what seems to be a useful feature can actually be very dangerous, especially when used on production servers. That’s the whole point of having a treeview. I understand why Redis Desktop Manager uses the KEYS command: it needs to retrieve all the keys in the database in order to determine how the tree structure will be displayed (since each delimited part of the key is rendered as a node). If you’re looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.” Don’t use KEYS in your regular application code. This command is intended for debugging and special operations, such as changing your keyspace layout. It may ruin performance when it is executed against large databases. “Warning: consider KEYS as a command that should only be used in production environments with extreme care. In fact, the KEYS command documentation particularly warns against its use in production environments: Retrieving all that data places a large burden on the Redis server, which due to its single-threaded nature will not be able to serve other requests while it is stuck retrieving every key in the database. ![]() Now, in this case I only have a handful of keys in my Redis database, but it’s pretty normal for real Redis databases to have very large numbers of keys. We can see an example of what this gives us by running the KEYS command ourselves: You’ll notice that the last command is a KEYS command, which with its wildcard argument (*) is effectively retrieving every key in the database. The first two commands are executed when Redis Desktop Manager connects to the Redis server, and the other two are executed when the database is expanded in the treeview, revealing the keys in that database. Indeed one of its features is that it presents a treeview showing a structured representation of the keys in the database:īut how is this treeview built? That’s easy to find out, by using the Redis MONITOR command to see the incoming commands: There’s a tool called Redis Desktop Manager which can sometimes be useful to inspect the keys in a Redis database. ![]() ![]() The original article below remains both for historical purposes and to warn developers of incorrect use of the KEYS command. Although this limits the applicability of this article to older servers, I am more than happy that this shortcoming has been addressed. Update 11th August 2015: As from version 0.8.0 beta 1, Redis Desktop Manager now supports the SCAN command (rather than KEYS) for Redis 2.8 onwards.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |