Choosing a PartitionKey and RowKey for a table
The Primary Key for a table in the Windows Azure Table Service is the combination of PartitionKey
and RowKey
. These properties are not symmetric in that the PartitionKey
and RowKey
serve different purposes. The PartitionKey
provides scalability for a table while the RowKey
ensures uniqueness for a given value of PartitionKey
.
A set of entities with the same PartitionKey
in a table is referred to as a partition. The Table service has a scalability target for a partition that is lower than that for the storage account. Consequently, performance can be improved by ensuring that data access is distributed across partitions. It is important that the PartitionKey
is designed, so that performance is optimized for the actual workload of a service.
An anti-pattern for the design of the PartitionKey
is the append pattern in which the PartitionKey
is created, so that all entities inserted in some interval of time are inserted in the same partition. For example...