Replace LeveledCompactionStrategy (LCS) with Cassandra 5.x default UnifiedCompactionStrategy (UCS) in schema.cql
Description
The Cassandra schema file /cassandra/temporal/schema.cql currently configures nearly all tables with LeveledCompactionStrategy (LCS). LCS is not a good general-purpose default — it's optimized for read-heavy workloads with low write amplification tolerance, and imposes unnecessary compaction overhead for tables that don't need it.
Cassandra 5.0 introduces UnifiedCompactionStrategy (UCS) as the new default, which is designed to work well as a general-purpose strategy across a broader range of workloads.
Describe the solution you'd like
Remove the explicit WITH COMPACTION = {...} clause from each table definition in schema.cql. Dropping the clause lets each table fall back to the engine's default compaction strategy:
On Cassandra 5.x, this will default to UnifiedCompactionStrategy (UCS). On earlier Cassandra versions, this will default to SizeTieredCompactionStrategy (STCS), so backward compatibility is preserved.
This avoids hardcoding a compaction strategy choice in the schema and lets each Cassandra version apply its own sensible default.
Looking for a first contribution, and this seemed approachable.
My read of schema.cql vs versioned/ is that this should only update schema.cql so new installs stop pinning LCS. I wouldn't add a versioned migration that ALTERs compaction on existing tables. That looks like a separate change, and prior migrations here don’t do that.
Does that match what maintainers want for this issue?
[Please ignore] Bumping to sync with our internal tracker
@ryancocuzzo yes, I would suggest removing the explicit level strategy and let Cassandra use the default. This would take effect for new deployments, should not change existing deployments.
@bschoening Hi, I'd be interested in working on this issue. Before proceeding, I wanted to clarify one detail about the proposed approach.
According to the Apache Cassandra documentation, SizeTieredCompactionStrategy (STCS) remains the default when no compaction strategy is specified, while UnifiedCompactionStrategy (UCS) is recommended for most workloads starting with Cassandra 5.0.
References: Cassandra UCS documentation Cassandra STCS documentation
This suggests that removing the explicit LCS configuration would result in STCS rather than UCS, even on Cassandra 5.x.
Could you confirm whether the intention is to use Cassandra's default compaction strategy (STCS) or explicitly configure UCS for Cassandra 5.x?
Happy to pick this up once the intended behavior is clarified. Thanks!
@Priya-Raut Since temporal supports multiple versions of Cassandra, it's probably best to just remove it and let Temporal use the default. Users can set the default to UCS on the cluster, if they wish.