I know it is working but I will like to know it this is a good practice of having the same string as PartitionKey and RowKey?
Thi scenario is for one single table where all items are unique, Customer
table where every row has info about one single customer.
What I mean is that for example I will get this unique customer ID and I want to use it to get the record by PartitionKey + RowKey so the return will be fast and one single item.
What do you think?
The row key is a unique identifier for an entity within a given partition. Together the PartitionKey and RowKey uniquely identify every entity within a table. The row key is a string value that may be up to 1 KiB in size. You must include the RowKey property in every insert, update, and delete operation.
To recap, a good partition key must meet the following requirements. Ensure it has enough cardinality to populate all the nodes of the deployment as we scale up. Ensure it is static, which means items will need to be reshuffled to another partition once inserted.
Table primary key. The primary key for an Azure entity consists of the combined PartitionKey and RowKey properties. The two properties form a single clustered index within the table. The PartitionKey and RowKey properties can store up to 1 KiB of string values.
How is the price calculated for the API for Table? The price depends on the allocated TableThroughput.
This will certainly make your customer look up quick. The RowKey can be an empty string so you technically don't have to make PartitionKey and Rowkey match if you will have a unique partition for every customer.
A couple of things to note here:
Check out the How to get most out of Windows Azure Tables article on choosing partition keys. You'll see most of what I said here is there as well (one of the places I learned it from) plus more.
Using a consistent string ID, "0" as your RowKey has the same uniqueness outcome as double PK. PK+0 = PK+PK.
A practical solution is considering the most common query process. You might use the zip/pocode within the PartitionKey -- and then the customer GUID in the RowKey. If your customer base is evenly spread over the country. PartitionKey doesn't necessitate PrimaryKey...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With