ClickHouse vs Cassandra: Choose by Query Pattern
ClickHouse and Cassandra both scale horizontally, but solve different problems. Compare their storage models, query patterns, consistency, and operational fit.
ClickHouse and Apache Cassandra are both distributed databases built for large datasets, which makes them look interchangeable on an architecture diagram. They are not. ClickHouse is a columnar analytical database designed to scan and aggregate many rows. Cassandra is a partitioned wide-column database designed to serve known, key-oriented access patterns with predictable availability.
The useful question is not “which database is faster?” It is what shape are your reads, and which failure modes matter?
The one-minute comparison#
| Decision | ClickHouse | Cassandra |
|---|---|---|
| Primary workload | OLAP, dashboards, logs, event analytics | High-volume key-oriented reads and writes |
| Data layout | Columnar | Partitioned wide-column rows |
| Query model | SQL over large ranges and aggregations | CQL around partition and clustering keys |
| Modeling approach | Optimize ordering and partitions for scans | Design a table around each known query |
| Typical strength | Flexible analytical questions | Predictable distributed availability |
| Typical mismatch | Per-row transactions and frequent point updates | Ad hoc joins and broad aggregations |
“Wide-column” in Cassandra does not mean the same thing as columnar analytical storage. Cassandra stores rows within distributed partitions. ClickHouse stores values from the same column together so an analytical query can read only the fields it needs.
How ClickHouse wants to be queried#
ClickHouse works best when a query touches many events but relatively few columns:
SELECT
toStartOfHour(event_timestamp) AS hour,
JSONExtractString(json, 'route') AS route,
quantile(0.95)(JSONExtractFloat(json, 'latency_ms')) AS p95
FROM events
WHERE event_timestamp >= now() - INTERVAL 24 HOUR
GROUP BY hour, route
ORDER BY hour, route
Columnar storage, compression, data skipping, and vectorized execution all support that pattern. You can change the grouping, add a filter, or compute another percentile without creating a new table for every question.
This makes ClickHouse a natural fit for:
- product and business events
- observability and log analytics
- live operational dashboards
- time-series aggregations
- large analytical APIs
ClickHouse can ingest continuously, but it is not an OLTP replacement. Frequent single-row updates, multi-row transactions, and point lookups are usually better handled by the application database that owns current state.
How Cassandra wants to be queried#
Cassandra begins with the queries you must serve. A table’s partition key decides which nodes hold the data, while clustering columns decide how rows are ordered within a partition. Efficient requests supply the partition key and read a bounded slice.
For a user activity feed, a model might look like:
CREATE TABLE activity_by_account_month (
account_id text,
month text,
occurred_at timestamp,
event_id uuid,
payload text,
PRIMARY KEY ((account_id, month), occurred_at, event_id)
) WITH CLUSTERING ORDER BY (occurred_at DESC);
That table serves “recent activity for this account and month” very well. A new requirement—say, “p95 latency by plan across every account”—does not naturally fit the same partition design. Cassandra applications often maintain another denormalized table or feed the data into an analytical system for that query.
Cassandra is compelling when you need:
- distributed writes across regions
- predictable key-based access at large scale
- tunable consistency per request
- high availability without a single primary node
- a data model built around a stable set of access patterns
Its official architecture documentation is explicit that performant queries are partition-oriented. That constraint is a feature when predictable access matters and a cost when the questions change.
Consistency and failure behavior#
Cassandra lets clients choose a consistency level for a read or write, trading latency and availability against how many replicas must agree. Its peer-to-peer architecture is designed to keep serving traffic through node and datacenter failures.
ClickHouse supports replication and distributed tables, but its priorities are analytical throughput and efficient scans. The exact consistency behavior depends on the table engine, replication, and query path you configure. Do not reduce this decision to a slogan like “one is eventually consistent.” Model the failures you expect and test the guarantees of the configuration you will actually run.
Operations are different too#
Both systems can become serious distributed infrastructure.
With Cassandra, partition size, tombstones, compaction, repair, replication, and consistency settings are central operating concerns. With ClickHouse, you will think about parts, merge pressure, ordering keys, partitions, replicas, memory, and distributed query behavior.
The teams required to operate either database well are different from the teams required to use them. A managed service can be the right choice even when the underlying database is open source.
A common architecture uses both#
The choice is not always exclusive:
- Cassandra serves the application’s predictable, low-latency key lookups.
- A change stream or event pipeline copies relevant facts into ClickHouse.
- ClickHouse serves dashboards, investigations, and broad aggregations.
That separation keeps operational traffic away from large scans and prevents analytical requirements from distorting the application data model.
Where GraphJSON fits#
GraphJSON uses ClickHouse because its workload is analytical: JSON events arrive continuously, then users filter, group, aggregate, compare, and query them in ways we cannot predict up front.
You get the benefit of that engine through a logging API, visualizer, SQL notebooks, dashboards, alerts, and embeds without operating a ClickHouse cluster yourself. Start with the logging quickstart, or go deeper with SQL for product analytics.

Written by JR
Founder and builder of GraphJSON.