@sargonpiraev

Key-value database

Created 1 min readseed · 1/5#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.

Theory that matters here

Key-value systems are shaped by access patterns more than schemas: key design, TTL, eviction policy, atomic operations, hot keys, and cache consistency usually matter more than joins or query planning.

Implementations

  • Redis — in-memory data store often used for caching, sessions, counters, queues, and low-latency coordination.

Related Redis implementation notes: