Rows with flexible columns, spread over many machines, built for huge writes (Cassandra, Bigtable).
A wide-column database stores data in tables, but spreads each table over many machines and is built for huge write volumes. Apache Cassandra, Google Bigtable, HBase and ScyllaDB are the well-known ones.
Picture a table that is too big for one computer. You must cut it into pieces. A wide-column database cuts it by the partition key. All rows with the same partition key stay together, in one partition. The key is hashed, and the hash picks the machine. Reads and writes for one key go to one place (and its replicas).
Inside a partition, rows are kept sorted by the clustering key. So "give me sensor s2 for Tuesday" is a read of one neat, contiguous slice. Writes are cheap because the engine appends them to a log and to memory first (an LSM tree, see that topic) and sorts later.
| Part | What it does | Example |
|---|---|---|
| Partition key | Hashed to choose the node. Same key, same partition. | sensor_id |
| Clustering key | Sorts rows within a partition. Allows range reads. | day, time (ASC or DESC) |
| Primary key | Partition key plus clustering columns. Must be unique. | ((sensor_id), day, time) |
| Regular columns | The data. Different rows can use different columns. | temp, battery |
| Keyspace | A group of tables with a replication setting. | RF = 3 in two data centres |
| TTL | Optional expiry per value, so old data deletes itself. | TTL 30 days |
| Query | Fits? | Why |
|---|---|---|
| Partition key = value | Yes | Goes to one set of replicas. |
| Partition key + range on the clustering key | Yes | A contiguous sorted slice. |
| Only a clustering column, no partition key | No | Must contact every node. |
| Filter on a normal column | No | Nothing is sorted by it. Scan, or use a second table or index. |
| Join, or GROUP BY across partitions | No | Not supported. Pre-compute or use Spark. |
SELECT * FROM readings WHERE sensor_id = 's2' AND day = 'Tue'A simplified model. The nodes are placed by a fixed rule here (real Cassandra hashes the partition key onto a token ring). The row counts are exact for this layout. The lesson: you design the table around the query, and a query that does not name the partition key does not fit.
CREATE TABLE readings ( sensor_id text, day date, time time, temp double, PRIMARY KEY ((sensor_id, day), time) ) WITH CLUSTERING ORDER BY (time DESC); -- one partition per sensor per day: bounded size SELECT * FROM readings WHERE sensor_id = 's2' AND day = '2026-12-02' LIMIT 50;
| Term | Meaning in easy words |
|---|---|
| Partition | All rows that share a partition key, stored together on the same replicas |
| Partition key | The part of the primary key that is hashed to pick the node |
| Clustering key | The part of the primary key that sorts rows inside a partition |
| Wide row | A partition holding many rows or columns, a good fit for a time series |
| Column family / table | A named group of rows. Bigtable says column family, Cassandra says table |
| Replication factor (RF) | How many copies of each partition exist |
| Consistency level | How many replicas must answer a read or write (ONE, QUORUM, ALL) |
| Memtable / SSTable | A sorted in-memory table / an immutable sorted file on disk |
| Compaction | Merging SSTables in the background to remove old versions |
| Tombstone | A marker that says a value was deleted. It is cleaned up later |
| Hot partition | One partition that gets far more traffic or data than others |
| Gossip | How Cassandra nodes tell each other who is alive |
| Choice | We gain | We lose |
|---|---|---|
| Big partitions | Fewer reads for a range | Hot spots, slow compaction, memory pressure |
| Small partitions | Even spread | Range queries touch many partitions |
| Consistency ONE | Speed and availability | Reads may be stale |
| Consistency QUORUM | Stronger reads and writes | More latency, less tolerance for node loss |
| Table per query | Fast reads for each | Duplicate data, more writes, you keep copies in sync |
| Higher RF | Durability and availability | More disk and write traffic |