@sargonpiraev

Key-value database

#database

A key-value database stores data as pairs: a key and a value.

The core idea is direct lookup. The application asks for a key, and the database returns the associated value.

Example

session:user_123 -> {"expiresAt":"2026-05-14T12:00:00Z"}
feature:homepage -> "variant-b"

The database does not need to understand the full structure of the value.

What it is good for

Key-value databases are useful for:

  • caching,
  • sessions,
  • feature flags,
  • counters,
  • short-lived coordination data,
  • simple high-speed lookups.

Tradeoff

The model is fast and simple, but it does not naturally support joins, complex filters, or rich query planning.

Redis is often used as a key-value database and in-memory data store.