Azure table query hints

2008-12-20 @ 22:08#

there has been and interesting thread on the Azure forum this week covering Azure Tables' use of PartitionKey and RowKey for Entity storage. while SDS uses a single-key format (Id), Azure Storage uses two keys for each object (PartitionKey and RowKey). it turns out Azure storage uses this two-key pattern as a way to optimize storage an queries. one of the outcomes of the thread is some advice on how to build optimal queries for Azure tables:

For the best query times, use a filter on the PartitionKey first, and then a filter on the RowKey if possible.A query that filters on just the RowKey (but not on a partition key) will only be as efficient as a filter on any other property.

Best
Filter on PartitonKey and RowKey
Next
Filter on PartitionKey and some other property
Last
Filter on just RowKey or any other property.

For efficiency, you should specify the filter on the PartitionKey even if it has the same value for all entities.

Azure