What is Cassandra's data model?

Answer

Cassandra uses a wide-column store model. Data is organized in keyspaces (similar to databases) containing tables. A table has rows, but unlike relational databases, rows can have different numbers of columns. Primary key: critical in Cassandra. Consists of: Partition key (required): determines which node stores the data via consistent hashing. All rows with the same partition key are stored together on the same node(s). Clustering columns (optional): sort rows within a partition, enable range queries. A table: CREATE TABLE user_events (user_id UUID, event_time TIMESTAMP, event_type TEXT, data TEXT, PRIMARY KEY (user_id, event_time)) WITH CLUSTERING ORDER BY (event_time DESC);. Queries must include the partition key — Cassandra is not designed for ad-hoc queries. The data model must be designed around query patterns, not normalized relationships. Denormalization and duplication are normal and expected in Cassandra.