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

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

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