Finding good candidates for partition keys
What is a good partition key? The answer is probably close to one that enables you to have the right number of partitions for ease of use and maintainability, but also one that enables partition pruning for your queries for optimal performance.
Getting ready
In order to choose a good partition key for your tables, you need to understand the nature of your data. This means you need to analyze your queries to determine the main keys that you’re using for data retrieval from those tables. Two desirable characteristics of partition keys are:
- They need to have a high enough cardinality, or range of values, for the number of partitions desired.
- They need to be columns that don’t change often, in order to avoid having to move rows among partitions.
How to do it…
First off, determine your access patterns for the table in question. See which keys you are selecting data by (the ones that are...