Cassandra Time-Series Cheat Sheet

Bucket keys and TTL

Last Updated: November 21, 2025

Focus Areas

Focus
Bucket by day/month
Embed TTL per row

Commands & Queries

CREATE TABLE readings (device text, day date, ts timestamp, value double, PRIMARY KEY ((device, day), ts))
Define schema
INSERT INTO readings (device, day, ts, value) VALUES (...) USING TTL 86400
Write with TTL
SELECT * FROM readings WHERE device='sensor' AND day='2024-01-01'
Read bucket

Summary

Partitioning + TTL keeps Cassandra time-series performant.

💡 Pro Tip: Keep partition rows under 100k for read efficiency.
← Back to Databases & APIs | Browse all categories | View all cheat sheets