Bulk actions

functional

Delete or expire keys by pattern with a dry-run count first, and import command files.

Bulk actions clean up many keys at once without giving up the safety of the one-key dialogs. Right-click a Redis database or a key folder in the explorer (on a database, the deletes and TTL changes sit under Bulk Edit and the command files under Import / Export):

  • Delete Keys by Pattern… (database) or Delete Keys in Folder… (folder)
  • Set TTL by Pattern… or Set TTL in Folder… - set an expiry on every matched key, or tick Remove expiry (PERSIST) instead to clear it
  • Import Command File… (database) - run a file of Redis commands, one per line
  • Export as Command File… (database) or Export Folder as Command File… (folder) - write the matching keys to a file that Import Command File… runs back

A single key's menu adds Rename… (RENAMENX, or RENAME when you allow overwriting) and, under Copy To, Copy to Database… (COPY key key DB n, Redis 6.2 and later) and Copy to Connection… (DUMP on this connection, RESTORE on the one you pick, expiry included). Each shows the exact command before it runs, is disabled on read-only and locked production connections (Copy to Connection checks the target connection too), and asks for a second click wherever a query tab would confirm. Ticking Replace overwrites a key that already exists at the destination; without it the copy refuses and says so.

Dry run first

Delete and TTL never write first. The dialog starts from the folder's prefix or the database's current key filter, and Count Matching Keys walks the keyspace with the same bounded SCAN the key browser uses (up to 25,000 keys), so the count changes nothing. The count runs a page at a time with a running total and a Stop button; a stopped or capped count is labelled partial, and the apply step touches only the keys the dry run listed, never the rest. You see how many keys match before anything can be applied. A bulk delete asks you to type the matched key count before its button is enabled, then runs batched UNLINK commands with a progress count and a Stop button; batches start at 500 keys and shrink (down to 50) whenever one takes longer than a second, so Stop never waits long for the batch in flight. A TTL change runs one EXPIRE or PERSIST per key, in batches paced the same way; the seconds field and the Remove expiry (PERSIST) instead box stay editable after the count. Binary key names are kept byte-exact throughout.

SQLly
Redis bulk delete: the dry-run match count for a folder's pattern before the confirmed, batched UNLINK.Redis bulk delete: the dry-run match count for a folder's pattern before the confirmed, batched UNLINK.
Redis bulk delete: the dry-run match count for a folder's pattern before the confirmed, batched UNLINK.

Acting on keys you selected

When the keys you want are easier to pick than to describe with a pattern, list them in a query tab with SQLLY.KEYS <pattern> <limit>, sort or filter the grid (by ttl_seconds, for example), select the rows, right-click, and choose Tools › Redis Keys › Delete Selected Keys…, Set TTL on Selected Keys… or Remove Expiry from Selected Keys…. There is no dry run to wait for: the selection is the list, so the dialog opens on the confirmation with the keys shown. A delete still asks you to type the key count, and keys on a cluster are deleted in batches that stay inside one hash slot. The action uses the connection and database of the tab the grid belongs to. See the key browser for which results offer the menu.

Importing a command file

Pick a UTF-8 text file with one command per line (SET, HSET, EXPIRE…; blank lines and # comments are skipped). Write binary values as quoted "\xHH" escapes. SQLly reads and parses the whole file before anything runs, and refuses a file that is not a runnable command script, naming the line: an unbalanced quote, a bad JSON line, or bytes that are not valid UTF-8. The run then attempts every line at most once, with a running count of commands processed. A failing line does not stop the import: each failure is listed with its line number, the command, and the server's error, and the summary counts what succeeded and what failed. A SELECT inside the file carries over to the lines after it.

The file runs in batches of about 200 lines, each on its own connection, so a MULTI … EXEC block is never split across two batches. If a line inside a transaction fails, the transaction is discarded: the rest of that block is skipped rather than run outside it, and the summary counts the skipped lines.

Exporting a folder as a command file

Export writes every key the folder's prefix (or the database's key filter) matches as the commands that rebuild it: SET for strings, HSET, RPUSH, SADD and ZADD in lines of up to 500 members, one XADD per stream entry with its original id, JSON.SET for JSON documents, then PEXPIRE for a key that had a time to live (counted from the import). Binary key names and values are written as "\xHH" escapes, so importing the file on an empty database gives back the same bytes, and the same number of keys. It only reads: nothing on the server changes, so it works on read-only connections too.

The export stops at the key limit you choose (10,000 by default) and at 8 MB, the import's file limit, so every export can be imported again. A stopped export ends with a # partial line, and types the import cannot rebuild (other module types) are listed as # skipped comments rather than left out silently. Stream consumer groups are not exported, only the entries. Importing on top of existing keys appends to lists and streams. Export into an empty database, or delete the folder first.

Safety review

Before an import runs, every line is checked against the same Redis command list the query editor uses. The dialog shows how many lines write, and lists by line number every destructive or server-administration command it found, such as FLUSHALL, FLUSHDB, DEL, CONFIG SET, SHUTDOWN, DEBUG, SCRIPT, MODULE and ACL. When any are present, or when the connection's safety settings would make the editor ask for confirmation, you have to type RUN ALL before the file can run.

Bulk writes and imports are disabled on read-only connections, and on a production connection while its writes are locked. The explorer items are greyed out, and the dialogs explain why while still allowing the count or file check. Unlock writes from the status-bar chip first. The lock is checked again when you confirm, so an unlock that expires while the dialog is open is honoured. If you close the dialog while a run is in progress, it stops after the batch in flight, and the partial summary goes to the status bar.