FLUSHDB(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– FLUSHDB β€” the "nuke the current database" page πŸ’–

okay bestie, so you found flushdb in the valkey command manual (section 3valkey, obviously). sit down, hydrate, and let's get into it 🫢


✨ NAME ✨

flushdb β€” remove all the keys from the current database. every single one. like, the whole vibe. gone.


✨ SYNOPSIS ✨

FLUSHDB [ASYNC | SYNC]

🌸 DESCRIPTION 🌸

so basically: this deletes every key in the currently selected DB. that's it. that's the whole thing. and here's the iconic part β€” this command never fails. it literally cannot flop. main character energy fr fr πŸ’…

by default, FLUSHDB flushes all keys from the database synchronously. but if you set the lazyfree-lazy-user-flush configuration directive to "yes", the default flush mode becomes asynchronous. that's a config directive, not a flag on this command, so don't @ me.

you can also dictate the flushing mode explicitly with one of these modifiers πŸ‘‡

  • ASYNC β€” flushes the database asynchronously
  • SYNC β€” flushes the database synchronously
⚠️ note (and this one MATTERS): 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. so if you're out here writing keys while the flush is running, those lil babies survive. no cap.

πŸŽ€ REPLY πŸŽ€

valkey-protocol(7) Simple string reply: OK.


πŸ¦‹ COMPLEXITY πŸ¦‹

O(N) where N is the number of keys in the selected database

so yeah, the more keys you got, the more work it's doing. it's giving proportional. 😭


πŸ‘‘ ACL CATEGORIES πŸ‘‘

@dangerous @keyspace @slow @write

(the @dangerous tag is right there for a reason bestie, respect it πŸ™ˆ)


⭐ HISTORY ⭐

  • Available since: 1.0.0
  • Changed in 4.0.0: Added the ASYNC flushing mode modifier.
  • Changed in 6.2.0: Added the SYNC flushing mode modifier.

🌈 SEE ALSO 🌈

go read these too, i'm literally obsessed:


and that's the whole page bestie πŸ’œ this was version 9.0.0, dated 2025-10-21, filed under FLUSHDB(3valkey) β€” now go forth and delete responsibly, because FLUSHDB does not do take-backs 🧚✨

πŸ“¦ where this page comes from