In Redis Insight's Bulk Actions, what actually runs when you delete keys matching a Browser filter on a live database, and what can go wrong?
answer
- the Browser filter becomes the scope
- scan a batch, pipeline a batch
- nothing paces the loop
- stopping keeps what is gone
- an estimate, not a count
basics
~20 sBulk Actions scans with your Browser filter, then pipelines one DEL or UNLINK per matched key on each primary, looping without pause until done or stopped. There is no undo, and the expected count is only an estimate.
solid answer
~50 sThe Browser's pattern and type become the filter, and the default pattern is `*`, so an unset filter targets every key in the selected logical database. On each primary, a runner loops: `SCAN` with `COUNT 10000`, `MATCH` and optional `TYPE`, then one pipeline holding a `DEL` or `UNLINK` per returned key, with no delay between rounds. So the dangers are load on the main thread and replicas, the memory spikes the tool itself warns about, an expected count that is only an estimate, and no undo. Stopping, or losing the socket, aborts between rounds and leaves a partial delete. As of 3.8, a database tagged Production needs its name typed to confirm, but an untagged one gets only a popover. I would preview in Browser, tick the report option, run it off-peak, and not use it on production.
go deeper
Recall that Bulk Actions deletes keys matching the Browser's filter, that an empty filter means every key in that database, and that there is no undo.
Explain the loop: SCAN with MATCH and optional TYPE, then a pipeline of one DEL or UNLINK per key, per primary. Know why the expected amount is only an estimate.
Name the failure modes: over-wide pattern, unpaced load, replication and big-key effects, partial results on stop, and a report that is no backup. Say what you would do instead on production.
Decide who may delete on which environment. A confirmation dialog depends on someone tagging the connection, so put the limit in ACLs and keep destructive cleanup as reviewed, paced work.
## What happens when you press Delete **Bulk Actions** looks like a list operation, but it is a loop against the live server. Reading the API module gives this sequence. 1. **The filter comes from Browser.** The panel takes the current key-name pattern and type. Deleting a folder in Tree view opens the same panel with that folder's pattern filled in. The API's defaults are `match` of `*` and no type. 2. **It prepares once.** It takes the **primary** nodes, and a runner per node reads the total key count a single time. 3. **Each runner loops.** It sends `SCAN` with the cursor, `COUNT 10000`, `MATCH` and optional `TYPE`. 4. **Each batch becomes a pipeline.** One `DEL` or `UNLINK` per returned key goes out at once. 5. **Results are per key.** Every reply counts as succeeded or failed, so errors do not stop the run, and the screen shows the first errors in a list. ```text SCAN 0 count 10000 match tmp:report:* type string UNLINK tmp:report:1 UNLINK tmp:report:2 ``` The API has a runner for each of `DEL` and `UNLINK`. The unlink runner falls back to `DEL` on a server too old to have `UNLINK`, and the optional report's header names the command that ran. ## Why the expected amount is not a promise Before you confirm, the panel says something like `Expected amount: ~N keys`. That is arithmetic from the Browser's scan so far: keys found, multiplied by total keys, divided by keys scanned. The tooltip says so directly: the final number may be different. On a pattern that matches unevenly, or where little has been scanned, it can be well off, and when nothing has been scanned it reads `N/A`. ## What can go wrong - **The pattern is wider than you think.** `tmp*` also matches `tmp_archive:2024`. An unset filter means every key in that logical database. Browser shows only what it has scanned, so the matches you see are not a full preview. - **Sustained load with no pacing.** The loop awaits one round and starts the next, with no delay and no feedback from server latency. Each `SCAN` walks about 10,000 entries on the main thread, even if few of them match. - **Writes travel.** Every deletion is a write that goes to replicas and to the append-only file if enabled. The tool's own warning reads: bulk deletion may impact performance and cause memory spikes, and to avoid running it in production. - **Big values.** A `DEL` on a very large collection frees it synchronously; `UNLINK` frees it in the background. The difference is covered with memory analysis, but it matters here because you are deleting many keys you have not looked at. - **Partial results.** **Stop** aborts between rounds, and a lost socket aborts every bulk action on that socket. The keys already deleted stay deleted, and a later run starts again from the current state. - **No undo.** The **Download report** option lists key names and outcomes, not values. It must be ticked before you start, and it is an audit trail, not a backup. - **Live traffic.** Deleting cache keys that are still being read sends those reads to the origin, whatever the tool does. Keys written during the run may or may not be seen by the scan. ## The guard in the tool Redis Insight 3.6 added a **Dev vs Production** classification per connection, and 3.8, the release this answer assumes, still has it: | Classification | Bulk delete confirmation | |---|---| | Production | Type the database's name in a modal | | Unspecified | Standard popover with the warning; this is the default for new and existing connections | | Development | The same popover in the bulk-delete footer, which only checks for Production; this class exists to reduce friction, not add it | This is friction in the GUI. Someone has to choose the tag, it is stored by Redis Insight rather than the server, and Redis still accepts whatever the connected user's ACL allows. A user without permission to delete is the real control: each `DEL` returns an error, and the keys are counted as failed. ## Using it safely 1. **Narrow the filter** with both a specific pattern and a type. 2. **Scan further in Browser** and read a sample of what matches before you trust it. 3. **Tick Download report** so you have a record of what went. 4. **Choose a quiet time** and watch the server's latency while it runs. 5. **Prefer a paced script for production.** A hand-written scan-and-unlink loop with pauses is slower but controllable; how to write one is covered with `SCAN`.
- What happens if the browser tab drops during a Redis Insight bulk delete?The provider aborts that socket's bulk actions when the connection is lost, and the loop exits after the current round. The keys already deleted stay deleted, the rest remain, and there is no resume: a new run scans again from the start and matches what is left.
- Does the Download report option in Redis Insight's bulk delete let you restore what was deleted?No. It streams key names with `OK` or an error, plus a summary of processed, succeeded and failed counts. It holds no values, so it tells you what went but cannot bring it back. Restoring means your backups or the source of truth. It also has to be enabled before the run starts.
- What happens if a Redis Insight user without delete permission runs a bulk delete?`SCAN` still succeeds, because it is a read. Each `DEL` or `UNLINK` in the pipeline then returns a permission error, which is counted per key as failed, and no data is removed. That makes the ACL the real guard, whichever tag the connection carries.
- Bulk delete is safe to size because the panel shows the exact number of keys it will remove.
- The Download report file is a backup you can restore deleted keys from.
- Pressing Stop rolls back the keys already deleted in that run.
- The Redis server itself enforces type-to-confirm for production-tagged databases.
- Bulk Actions slows itself down automatically when the server gets busy.
Assumes Redis Insight 3.8; the Dev vs Production classification and its type-to-confirm step arrived in 3.6.