🔑 Primary Keys & Partition Keys
Explain the difference between Partition Key, Clustering Column, and Primary Key.
Partition Key
- Purpose: Distributes data across nodes
- Required: In every WHERE clause
- Hashed: Determines node placement
- Example: user_id
Clustering Column
- Purpose: Sorts data within partition
- Optional: Can use in WHERE/ORDER BY
- Sorted: Stored in order on disk
- Example: timestamp