# FLUSHDB

> Delete every key in the selected database.

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

```
FLUSHDB [ASYNC | SYNC]
```

- Group: Server
- Complexity: O(N) where N is the number of keys in the database
- HotKV Cloud: all plans
- On-Premise: no license needed

`FLUSHDB` deletes every key in the connection's selected database, and the
tags attached to those keys. Other databases are not touched. Like any
write, it is sent to replicas and written to the append-only file. There is
no undo.

## Options

| Option | Effect |
| --- | --- |
| `ASYNC` | Accepted. The keys are deleted before the reply, as with `SYNC`. |
| `SYNC` | Delete the keys before replying. |

## Return value

| Case | Reply (RESP2 and RESP3) |
| --- | --- |
| Flushed | Simple string `OK` |
| Any other argument | Error `ERR syntax error` |

## Examples

```
127.0.0.1:6379> DBSIZE
(integer) 1520
127.0.0.1:6379> FLUSHDB
OK
127.0.0.1:6379> DBSIZE
(integer) 0
```

In HotKV Cloud, the CLI tab of the panel does not run `FLUSHDB`. Send it
from your own client connection.

## Compatibility

Same as Redis 7 and Valkey 8, except that `ASYNC` does not defer freeing
memory to the background.

## See also

[FLUSHALL](https://docs.hotkv.com/commands/flushall/index.md), [DEL](https://docs.hotkv.com/commands/del/index.md), [SELECT](https://docs.hotkv.com/commands/select/index.md),
[DBSIZE](https://docs.hotkv.com/commands/dbsize/index.md)