# DISCARD

> Drop the commands queued since MULTI and leave the transaction.

URL: https://docs.hotkv.com/commands/discard/

```
DISCARD
```

- Group: Transactions
- Complexity: O(N) where N is the number of queued commands
- HotKV Cloud: all plans
- On-Premise: no license needed

`DISCARD` throws away every command queued since [MULTI](https://docs.hotkv.com/commands/multi/index.md),
ends the transaction without running anything, and unwatches all keys watched
with [WATCH](https://docs.hotkv.com/commands/watch/index.md).

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The transaction was discarded | Simple string `OK` | Simple string `OK` |
| No `MULTI` was sent | Error `ERR DISCARD without MULTI` | Error |

## Examples

```
127.0.0.1:6379> MULTI
OK
127.0.0.1:6379(TX)> DEL important
QUEUED
127.0.0.1:6379(TX)> DISCARD
OK
127.0.0.1:6379> EXISTS important
(integer) 1
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[MULTI](https://docs.hotkv.com/commands/multi/index.md), [EXEC](https://docs.hotkv.com/commands/exec/index.md),
[UNWATCH](https://docs.hotkv.com/commands/unwatch/index.md)