← Back to Glossary

Key-value store

A key-value store is a simple database model that maps unique keys to values, optimized for very fast lookups, writes, and updates by key, without the fixed schema or query flexibility of a relational database.

Overview

A key-value store is one of the simplest and oldest database models: data is accessed as an opaque value retrieved by a unique key, similar to a dictionary or hash map, but persistent and often distributed. Popular examples include Redis (in-memory, often used as a cache), Amazon DynamoDB, and etcd (used for configuration and coordination). Because operations are limited to lookups, writes, and deletes by key (and sometimes simple range scans over sorted keys), key-value stores can achieve very high throughput and low latency, and many scale horizontally by partitioning keys across nodes.

Trade-offs versus relational databases

The simplicity that makes key-value stores fast also limits their query flexibility: there's typically no equivalent of SQL joins, aggregations across many keys, or ad hoc filtering by value contents (some stores add secondary indexes or limited query capabilities on top, but this isn't the core model). They're a strong fit for access patterns that are genuinely "fetch this one record by its ID" — session storage, caching, feature flags, user profile lookups — and a poor fit for analytical questions like "what's the average order value by region last month," which require scanning and aggregating across many records.

Where DuckDB fits

DuckDB is a relational, SQL-based analytical engine, not a key-value store — it's built for exactly the kind of cross-record aggregation and ad hoc analysis that key-value stores don't do well. In practice, the two are often complementary in an application architecture: a key-value store (or cache) serves low-latency, per-key lookups on the request path, while a table storing the same or related data can be analyzed in bulk with DuckDB for reporting, dashboards, or offline analysis.

Related terms

FAQS

Not natively — the core model is key lookups, not declarative querying. Some systems layer limited query capabilities (secondary indexes, simple filters) on top, but ad hoc joins and aggregations are not what key-value stores are designed for.

Yes, Redis is one of the most widely used key-value stores, commonly deployed as an in-memory cache or session store, though it also supports richer data structures (lists, sets, sorted sets) beyond plain string values.