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 | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
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
- https://www.allthingsdistributed.com/2007/10/amazons_dynamo.html
Supports
- Dynamo's get/put interface as the base key-value model
- Values as opaque objects with no relational schema or multi-item transactions
- Shopping cart availability motivation and write-availability-over-consistency tradeoff
- Consistent hashing, vector clocks, and quorum as underlying techniques
- Introduction origin story, glossary entries, slides, video script, and 06-links rationale
- https://redis.io/docs/latest/develop/data-types/
Supports
- Redis as a data structure server with strings, hashes, lists, sets, sorted sets, and streams
- Redis value-type explanation across intro, slides, cheatsheet, quiz, and video script
- https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/
Supports
- RDB snapshot and AOF append-only file persistence options and their tradeoffs
- Combinability of RDB and AOF, and default fsync-every-second durability bound
- Durability discussion and related quiz answer
- https://redis.io/docs/latest/operate/oss_and_stack/management/scaling/
Supports
- Redis Cluster's 16,384 hash slots and CRC16(key) mod 16384 slot assignment
- Downtime-free resharding by moving slot ranges between nodes
- Hash tags forcing related keys into the same slot for multi-key operations
- Partitioning explanation and related quiz answer
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html
Supports
- DynamoDB tables, items, and attributes vocabulary
- Simple (partition key) vs composite (partition key + sort key) primary keys
- Partition key hashing determining physical placement; sort key ordering within a partition
- Secondary indexes and DynamoDB Streams
- Core-components explanation and related quiz answer
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html
Supports
- Per-partition throughput ceilings independent of total table provisioned capacity
- Hot partition key risk from uneven access patterns
- Partition-key design guidance and related quiz answer
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html
Supports
- Eventually consistent (default) vs strongly consistent read semantics and cost difference
- Strongly consistent reads supported on tables and local secondary indexes, not global secondary indexes or streams
- Consistency-model explanation and related quiz answer
- https://etcd.io/docs/latest/learning/data_model/
Supports
- etcd as a multiversion key-value store for infrequently updated, highly reliable data
- Revisions, versions, and watch/point-in-time-read support
- Coordination-store role distinct from application data storage
- https://memcached.org/
Supports
- Memcached as a deliberately simple, free and open-source distributed in-memory object caching system
- Purpose of alleviating backing-database load
- Comparison with Redis in intro and quiz
- https://github.com/facebook/rocksdb/wiki/RocksDB-Overview
Supports
- RocksDB as an embeddable persistent key-value store using a log-structured merge (LSM) tree
- Memtable, write-ahead log, and SST file components, with background compaction
- Optimization for fast storage media such as flash
- https://rocksdb.org/
Supports
- RocksDB official project description as an embeddable persistent key-value store for fast storage
- 09-awesome-links entry and rationale
- https://www.symas.com/lmdb
Supports
- LMDB as an embedded key-value store using a memory-mapped B-tree
- ACID/MVCC semantics, zero-copy reads, and absence of background compaction or cleanup
- Comparison against RocksDB's LSM-tree design
- https://riak.com/products/riak-kv/index.html
Supports
- Riak KV's masterless, ring-distributed architecture with buckets of key-value pairs
- Availability-first guarantee (reads/writes succeed during hardware failures or partitions)
- Dotted version vector conflict resolution as an eventual-consistency mechanism
- https://aerospike.com/products/database/
Supports
- Aerospike as a multi-model database including a key-value access pattern
- Sub-millisecond response times and in-memory/flash/hybrid storage tiers
- 09-awesome-links entry and rationale
- https://github.com/numetriclabz/awesome-db
Supports
- Curated discovery of Memcached, RocksDB, LMDB, Riak, and Aerospike as ecosystem key-value projects
- Awesome Links selection
- https://en.wikipedia.org/wiki/Memcached
Supports
- Memcached release date (2003) and origin story for LiveJournal
- Timeline milestone
- https://en.wikipedia.org/wiki/Redis
Supports
- Redis release date (2009) and origin as a Tcl prototype
- Timeline milestone
- https://en.wikipedia.org/wiki/Riak
Supports
- Riak 1.0 release date (2011) and feature set
- Timeline milestone
- https://press.aboutamazon.com/2012/1/amazon-web-services-launches-amazon-dynamodb-a-new-nosql-database-service-designed-for-the-scale-of-the-internet
Supports
- DynamoDB launch date (January 2012) and initial feature set
- Timeline milestone
- https://www.cncf.io/reports/etcd-project-journey-report/
Supports
- etcd first commit (June 2013) and CNCF incubation history
- Timeline milestones
- https://redis.io/blog/redis-7-generally-available/
Supports
- Redis 7.0 GA date (April 2022) and feature summary
- Timeline milestone
- https://www.linuxfoundation.org/press/linux-foundation-launches-open-source-valkey-community
Supports
- Valkey fork from Redis (March 2024) and Linux Foundation governance
- Timeline milestone
- https://engineering.fb.com/2013/11/21/core-infra/under-the-hood-building-and-open-sourcing-rocksdb/
Supports
- RocksDB open-source release date (November 2013) and origin from LevelDB
- Timeline milestone
- https://dev.to/vadim_albarov/oops-i-forgot-to-tell-you-thats-dangerous-clude-code-watched-me-wipe-production-redis-then-300h
Supports
- Field note: enabling AOF via config file without prior CONFIG SET wipes dataset on restart
- https://medium.com/@erwindev/redis-as-primary-store-a-cautionary-tale-of-data-loss-6bc1cd7c5a91
Supports
- Field note: appendfsync always makes Redis write latency comparable to disk-based stores
- https://www.72technologies.com/blog/dynamodb-hot-partition-black-friday-postmortem
Supports
- Field note: table-level DynamoDB metrics hide per-partition throttling without Contributor Insights
