SysPad › Lessons › database lessons › Keyspaces (Cassandra)
How Keyspaces (Cassandra) works
Serverless, Apache Cassandra-compatible wide-column database. No nodes to manage - capacity scales like DynamoDB via read/write units. Single-digit-millisecond reads at LOCAL_QUORUM consistency.
Keyspaces is for teams who already speak Cassandra (CQL) but never want to run a Cassandra ring again. It keeps the wide-column model and the query language, but throws away the cluster: no nodes to size, repair, or rebalance. The mental model is close to DynamoDB, with one extra superpower, sorted rows inside a partition.
What you will learn
- What does "wide-column" actually mean, and how is it like (and unlike) DynamoDB?
- Why do clustering columns make time-range queries inside a partition so cheap?
- What does serverless remove compared to running your own Cassandra cluster?
- How do you trade read consistency for latency and availability?
Partition key + clustering columns
Keyspaces uses the wide-column model. A partition key spreads rows across partitions for scale (just like DynamoDB). The twist: clustering columns keep the rows within a partition physically sorted.
Why sorted rows matter
Because rows sit sorted by the clustering column, a query for a contiguous range ("readings between 9:00 and 12:00 for sensor 7") reads a sorted slice instead of scanning and filtering.
That makes Keyspaces a natural fit for time-ordered data within an entity: message histories, event logs per device, feeds, and similar.
⚓ Common when migrating existing Cassandra apps, or for write-heavy, partition-then-range workloads.
Serverless: no ring to run
Self-managed Cassandra means operating a cluster: adding nodes, repairs, compaction tuning, rebalancing. Keyspaces is serverless, tables scale automatically and you choose on-demand (pay per request) or provisioned throughput, much like DynamoDB.
You keep CQL and the Cassandra drivers; you drop the operational burden of the ring.
Tuning consistency vs latency
Like Cassandra, reads have a tunable consistency level. LOCAL_QUORUM reads agree with a majority of replicas (more consistent); LOCAL_ONE reads from a single replica (lower latency, possibly slightly stale).
Flashcards
- In Keyspaces, what decides a row’s partition, and what decides its order within it?
- The partition key chooses the partition (scale); clustering columns keep rows sorted within that partition.
- Why is "device 7’s events from 9–12" cheap in Keyspaces?
- Rows are physically sorted by the clustering column (time), so the range is a sequential slice, not a scan-and-filter.
- What operational work does Keyspaces remove versus self-managed Cassandra?
- Running the ring: node provisioning, repairs, compaction tuning, rebalancing. It’s serverless with on-demand or provisioned throughput.
- Do you have to rewrite your Cassandra app’s queries to use Keyspaces?
- Largely no, it’s CQL / Cassandra-API compatible, so existing drivers and queries mostly work (verify edge cases).
- LOCAL_ONE vs LOCAL_QUORUM, what’s the trade?
- LOCAL_ONE: lower latency, possibly slightly stale. LOCAL_QUORUM: agrees with a majority of replicas, more consistent but a bit slower.
Sources
- AWS, What is Amazon Keyspaces (for Apache Cassandra)
- AWS, Data modeling: partition keys and clustering columns
- AWS, Read consistency levels
- AWS, Read/write capacity modes (on-demand and provisioned)
Open the SysPad canvas · Official Keyspaces (Cassandra) documentation