Restricting queries using WHERE clauses
Tables have two types of columns with special roles: the partition key and the clustering columns. Together they define the primary key:
-
Partition key (PK) columns: The first part of primary key defines the hash that is used to spread data evenly across the data center.
-
Clustering columns: The last part of the primary key that orders the data within a partition.
Partition keys, clustering, and normal columns have different sets of restrictions within the WHERE clause. Those restrictions differ depending of the type of command: SELECT, UPDATE, or DELETE.
- Partition keys
-
Identify partition keys to limit the query and retrieve data from specific nodes.
- Clustering columns
-
Restrict queries on clustering columns and find ranges across clustering segments.
- Retrieval using the IN keyword
-
Using the SELECT command with the IN keyword.
- Sorting and limiting results
-
Using the SELECT command for simple queries.