Why it matters

Well-chosen clustering columns enable range queries in milliseconds. Poorly chosen ones force scans or make queries impossible. This is core data modeling.

Advertisement

The architecture

Sort order: clustering columns can be ASC or DESC. Fixed at table creation.

Composite clustering: multiple columns. Sort is lexicographic: first column, then second within same first, etc.

Row addressingPartition keywhich partitionClusteringorder withinStatic columnone value per partitionQuery with partition key + range on clustering column is fast (~1 ms)
Row addressing model.
Advertisement

How it works end to end

Range queries: within a partition, WHERE clustering_col > X ORDER BY clustering_col works efficiently.

ALLOW FILTERING: forces cluster-wide filtering; slow and expensive. Never use in production.

Reverse queries: order specified in table works fast; reverse order needs SSTable inversion.