Shard key
Definition
A shard key (or partition key) is the field whose value is hashed or range-mapped to pick the shard holding a row; a sort key orders rows within one partition.
In practice
Queries that include the shard key go to one shard; queries without it must ask all shards and wait for the slowest. So the key should match the main access pattern, such as user_id for per-user data. A composite key (hash a partition part, sort by another part) gives spread writes plus cheap range reads within one entity.
A key with few distinct values or skewed popularity creates hot partitions that adding shards cannot fix. Monotonic keys such as timestamps pile onto one partition under range partitioning. Changing the shard key later means moving most of the data, so it is one of the hardest decisions to reverse.
Example
A messages table with partition key conversation_id and sort key sent_at reads the latest 50 messages of a chat from one partition, but "all messages by user 42" fans out to every partition.