The table's primary key
The table's primary key consists of the PartitionKey
and
RowKey combined; it is the only index for the table and it allows for faster retrieval of data by holding low-level addresses to rows. The rows in a table will always be sorted by the PartitionKey, then the RowKey, and querying a table will also return results sorted by its primary key. Since keys are of string type, it is good to have fixed size keys to ensure good sorting results. For instance, in a query result, an entity with RowKey 123
will appear before an entity with RowKey 2
; to fix this it is better to pad out your key to become 002
.
Tip
The tables should be designed to be queried using these keys; depending on the size of the table, an ad hoc query could be slow if not using any of the keys. We will examine all types of queries later in this chapter.