Skip to main content

Time Series Compaction (TSCS)

A compaction strategy that groups SSTables into fixed time windows. Recent windows are compacted as usual, while closed windows are frozen into a single SSTable per window, and windows past their retention period are deleted wholesale without compaction.

Separate from tiered storage

TSCS is a compaction strategy, while tiered storage is a table extension. You can enable just one, and enabling TSCS first carries lower risk.

Configuration​

ALTER TABLE pp.tm_tag_point WITH compaction = {
'class': 'TimeSeriesCompactionStrategy',
'window_size': '1d',
'freeze_after': '2d',
'retention': '3650d'
};
OptionDefaultDescription
window_size1hThe width of a single window. SSTables are assigned to a window based on their maximum timestamp
freeze_after2hHow long after a window closes before it becomes eligible for freezing. This is the grace period for late-arriving data
retentionNoneWindows older than this are deleted entirely. If not set, nothing ever expires
max_future_window1dWindows that are too far in the future are excluded from all automatic paths
timestamp_resolutionMICROSECONDSThe timestamp unit for cells. This is rarely changed
Align window_size with your query patterns

If your dashboard reads in daily increments, 1d is a natural choice. Windows that are too narrow only increase the number of SSTables and the overhead of window management — with a 10-year retention and 1h windows, you would have 87,600 windows.

Life of a Window​

[현재 창] [닫힘, freeze_after 이내] [동결됨] [만료]
────────────────┼───────────────────────────┼─────────────────┼──────────────
UCS 에 위임 여전히 UCS 창당 1 SSTable 통째로 삭제
(평소 컴팩션) (지각 데이터 흡수) 이후 손대지 않음 (컴팩션 없음)

The current window and recently closed windows delegate to their internal UnifiedCompactionStrategy — in these actively written sections, they behave just like the upstream UCS.

🔴 Expiration is handled by retention — not by TTL​

If you don't set retention, nothing ever expires. Even if you have row-level TTL in place, that's a different story from TSCS window deletion.

Window-level deletion is preferable because it removes files without running compaction. With TTL-based expiration, you'd have to create tombstones and clean them up through compaction — and for time series data, where old data is discarded wholesale, that cost is pure waste.

Late-Arriving Data Isolation​

Even if an edge that was disconnected uploads several days' worth of data at once, flushing and streaming diverge at window boundaries. Late data is thus written separately into the past window it belongs to, without touching the current window and forcing another compaction. Older SSTables that span multiple windows are automatically split.

Parked Windows — Windows Making No Progress​

A window that is stuck and cannot transition to freezing is said to be "parked." There is only one cause — routing buffer overflow. Diagnostics and value adjustments are documented in the operator's manual.

Verification​

-- 지금 이 테이블에 걸린 컴팩션 설정
SELECT compaction FROM system_schema.tables
WHERE keyspace_name = 'pp' AND table_name = 'tm_tag_point';

See Also​