openskills.info
Course Preview

Key-Value Databases

A key-value database stores data as pairs: a unique key and the value stored under it, with no fixed columns and no built-in way to query by anything but that key. It trades the flexibility of a relational database for speed and horizontal scale, and it runs the caches, session stores, and shopping carts behind many large-scale online systems.

itDatabases and data storage

Don't Panic — Key-Value Databases

A key-value database is exactly what it sounds like: you give it a key, it gives you back the value stored under that key. That is the whole interface in its purest form. No columns, no query language, no schema — just a key and the blob it points to.

Before this model existed, the shopping cart problem at Amazon was a real headache. Disks fail, data centers go dark, and a relational database that refuses your write during a network blip is a database that just lost you a sale. Amazon built Dynamo to solve this: keep accepting writes during failures, resolve the conflicting versions afterward, and never block a customer to guarantee perfect consistency in the moment. That trade — give up joins and complex queries in exchange for availability and scale — is what every key-value database makes.

Two ideas carry the whole category. First, hashing decides placement: DynamoDB hashes the partition key to pick a physical partition; Redis Cluster hashes the key to pick one of 16,384 fixed slots. This is how these systems scale horizontally — but it is also why key design is capacity design. A single key that absorbs too much traffic hits a per-partition throughput ceiling while the rest of the table sits idle. Second, consistency is a dial, not a label: DynamoDB defaults to eventually consistent reads that cost half as much but may miss a very recent write; you can request a strongly consistent read at higher cost. Riak KV goes further, accepting reads and writes during network partitions and resolving conflicts after the fact.

What will surprise you: Redis persistence is a lie you tell yourself. RDB snapshots lose minutes of writes between dumps. AOF can bound loss to about one second, but the moment you set appendfsync always to get zero data loss, your "blazing fast" in-memory store suddenly has the write latency of a disk-based relational database — without the relational engine you gave up to get here. Durability has a cost, and the curve has no free lunch.

A key-value database is the wrong choice when you need to filter by fields inside the value, join across records, or ask questions you have not designed a key for. It rewards knowing your access patterns up front and punishes discovering a new one after you have already committed to the keys.

Start with the Intro to understand the four roles the model plays and when it fits. The Slides map the relationships between products and tradeoffs. The Cheatsheet is the quick-reference card for design reviews. If you are evaluating whether this topic deserves your week, the Field Notes tell you what it costs when teams get it wrong.

Where this skill leads

Relevant careers

See how this topic contributes to broader role-level skill maps.

Sources