intermediateCassandra — Partitioning, Replication & Consistency

You're building an IoT platform collecting 1 million sensor readings per second. Sensors report temperature every second. How do you design the Cassandra schema?

Time-series design challenge: naive partition key = device_id creates hot partitions when one device writes 86,400 rows/day × years. Solution with time bucketing: CREATE TABLE sensor_readings (device_id TEXT, bucket DATE, reading_time TIMESTAMP, temperature DECIMAL, humidity DECIMAL, PRIMARY KEY ((device_id, bucket), reading_time)) WITH CLUSTERING ORDER BY (reading_time DESC) AND default_time_to_l

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

You're building an IoT platform collecting 1 million sensor readings per second. Sensors report temperature every second. How do you design the Cassandra schema?

Next Step

Continue to When would you choose a graph database over a relational database?← Back to all NoSQL questions