Clustering key
A clustering key is a primary-key component that orders rows within a partition.
ScyllaDB in Action
A clustering key is a primary-key component after the partition key that orders rows within a partition.
- How it is used
- Organizes rows within a partition so table results match query-specific ordering needs.
- How deep it goes
- Defines partition-local ordering, default directions, explicit CQL ordering, and the consecutive-column read rule.
- Examples
- Uses food reviews ordered by time and food, plus article summaries ordered by descending article ID.
- What you can do after
- Apply it via CQL to order partition-local results and write queries using consecutive primary-key columns.
Spring in Action, Sixth Edition
A clustering key is the component of a Cassandra primary key that determines the ordering of rows within a partition.
- How it is used
- Uses clustering keys to arrange related Cassandra rows within partitions for a read-oriented data model.
- How deep it goes
- Defines partition placement and within-partition ordering, then demonstrates descending timestamps without detailing query-result ordering.
- Examples
- Demonstrates a Taco UUID partition key with createdAt as a descending clustering key.
- What you can do after
- Apply it via Spring Data Cassandra annotations to order rows within a chosen partition.
Read how Spring in Action, Sixth Edition explains clustering key →
Related concepts
- order by clauseused by · An ORDER BY clause specifies the ordering of query results according to one or more expressions, fields, or sort directions.
- primary keypart of · A primary key is a designated column or attribute, or combination of them, that uniquely identifies each row or item in a table or data store.
- @primarykeycolumnconfigured by · @PrimaryKeyColumn is a Spring Data Cassandra annotation that maps a property to a specifically configured primary-key column.
- SQLused by · SQL is a standardized declarative language for defining, querying, and manipulating data and structures in relational database systems.
- data groupinguses · Data grouping is the organization of data into groups according to shared values, keys, or other criteria, supporting grouped processing, analysis, or retrieval.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

