What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

FLUSHDB

Removes all keys from the current database.

Usage
FLUSHDB [flush-type]
Complexity
O(N) where N is the number of keys in the selected database
Since
1.0.0
ACL Categories
@dangerous, @keyspace, @slow, @write
Command flags
WRITE

Delete all the keys of the currently selected DB. This command never fails.

By default, FLUSHDB will synchronously flush all keys from the database. Setting the lazyfree-lazy-user-flush configuration directive to "yes" changes the default flush mode to asynchronous.

It is possible to use one of the following modifiers to dictate the flushing mode explicitly:

  • ASYNC: flushes the database asynchronously
  • !SYNC: flushes the database synchronously

Note: an asynchronous FLUSHDB command only deletes keys that were present at the time the command was invoked. Keys created during an asynchronous flush will be unaffected.

Replies

RESP2

RESP3

History

  • 4.0.0: Added the `ASYNC` flushing mode modifier.
  • 6.2.0: Added the `SYNC` flushing mode modifier.