content/commands/xdelex.md
Deletes one or multiple entries from the stream at the specified key.
XDELEX is an extension of the Redis Streams [XDEL]({{< relref "/commands/xdel" >}}) command that provides more control over how message entries are deleted concerning consumer groups.
The name of the stream key.
</details> <details open> <summary><code>IDS numids id [id ...]</code></summary>The IDS block specifying which entries to delete:
numids: The number of IDs that followid [id ...]: One or more stream entry IDs to deleteNote: The IDS block can be at any position in the command, same as other commands.
</details>Specifies how to handle consumer group references when deleting entries. Available since Redis 8.2. If no option is specified, KEEPREF is used by default:
KEEPREF (default): Deletes the specified entries from the stream, but preserves existing references to these entries in all consumer groups' PEL (Pending Entries List). This behavior is similar to [XDEL]({{< relref "/commands/xdel" >}}).DELREF: Deletes the specified entries from the stream and also removes all references to these entries from all consumer groups' pending entry lists, effectively cleaning up all traces of the messages. If an entry ID is not in the stream, but there are dangling references, XDELEX with DELREF would still remove all those references.ACKED: Only deletes entries that were read and acknowledged by all consumer groups.The command provides fine-grained control over stream entry deletion, particularly useful when working with consumer groups where you need to manage pending entry references carefully.
{{% redis-cli %}} XADD mystream * field1 value1 XADD mystream * field2 value2 XADD mystream * field3 value3 XRANGE mystream - + XDELEX mystream KEEPREF IDS 2 1526919030474-55 1526919030474-56 XRANGE mystream - + {{% /redis-cli %}}
| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |
{{< multitabs id="xdelex-return-info" tab1="RESP2" tab2="RESP3" >}}
One of the following:
ACKED option); also, if there are no consumer groups.-tab-sep-
One of the following:
ACKED option); also, if there are no consumer groups.{{< /multitabs >}}