

One order line for a specific item (PK + RK should be unique) Well as the item bought, of course given that one order can only contain (PK: order id, RK: item id) – allows fast querying on both order id as

Of course, depending on the system you are building, the following may be a better setup:Ĭustomer (PK: customer id, RK: display name) – it enables fast searches on customer id and display name Orderline (PK: order id, RK: order line id) – allows fast querying on both order id as well as order line id. It still allows fast querying on a specific order id as well) Orders for a specific customer (as they are colocated in one partition), (PK: customer id, RK order id) – it allows me to quickly fetch all Let’s use three tables: Customer, Order and Orderline.Īn ideal setup may be this one, depending on how you want to query everything:Ĭustomer (PK: sales region, RK: customer id) – it enables fast searches on region and on customer id What will you choose as the PartitionKey (PK) / RowKey (RK)? Here’s an exercise: say you want to store customers, orders and In order to improve query performance, think about your PartitionKeyĪnd RowKey upfront, as they are the fast way into your datasets.
#Ipartition key windows#
Note that Windows Azure storage may decide to group partitions in so-called "Range partitions" - see. Slow: searching on other properties (again, spans multiple partitions and properties). Wihtin a partition, searching on RowKey is still pretty That possibly spans multiple partitions, possibly multiple storage Storage no pointer on which partition to search in, resulting in a query Less fast but still fast enough will be querying by specifying PartitionKey: table storage will know which partition to query.

Query and can simply do an ID lookup on RowKey within that partition. The fastest way of querying? Specifying both PartitionKey and RowKey.īy doing this, table storage will immediately know which partition to Don’t just assign them a guid or a random string as it does PartitionKey and RowKey and performanceīefore building your code, it’s a good idea to think about both So in essence, a RowKey is just the identifier of an entity within a partition. If you use multiple partitions, the same RowKey can be Within one PartitionKey, you can only have PartitionKey + RowKey form the composite unique And that’s where our next concept kicks in… RowKey in Table StorageĪ RowKey in Table Storage is a very simple thing: it’s your “primary Partition, but you’ll find that querying your data becomes moreĭifficult. You can do this and every entity stored will end up in its own You set the PartitionKey to a unique value for every entity stored? No. You’ll end up with scaling issues at some point. Should you set the PartitionKey to the same value for every entity Maximal throughput as there’s lots of entities in the same partition. Partition key), you’ll be limited to the size of the storage machinesįor the amount of storage you can use. If you put every entity in the same partition (by using the same InĮssence, you are responsible for the throughput you’ll get on your In Table Storage, you have to decide on the PartitionKey yourself. In tables, it’s different: you decide how data is co-located in the system.In queues, every queue is a separate partition.That every blob can get the maximal throughput guaranteed by the system. In blob storage, each blob is in a separate partition.Partitions are different for every storage mechanism: Location where there’s enough disk space available. If a partition gets busy, it’s moved to a server Size, the Windows Azure storage management can kick in and move aīy doing this, Windows Azure can ensure a high throughput as well as Whenever a partition gets a high load or grows in Only 3 physical machines that are used for storing data in Windows Azureīased on the size and load of a partition, partitions are fanned outĪcross these machines. Partitions are used for scale out in the system. Windows Azure storage, it is located on some partition in the system. While there’s much more to tell about it, the reason why it scales isīecause of its partitioning logic. What are these for? Do I have to specify them manually? Let’s explain… Windows Azure storage partitionsĪll Windows Azure storage abstractions (Blob, Table, Queue) are built upon the same stack (whitepaper here). One of the questions he recently had was around PartitionKey and RowKey in Windows Azure Table Storage. For the past few months, I’ve been coaching a “Microsoft Student Partner” (who has a great blog on Kinect for Windows by the way!) on Windows Azure.
