0

I tried using CloudTable::ExecuteBatch(new TableBatchOperation{operation1, operation2}); Each operation was a Retrieve operation. The snippet in question looked like this:

var partitionKey = "1";

var operation1 = TableOperation.Retrieve(partitionKey, "1");
var operation2 = TableOperation.Retrieve(partitionKey, "2");

var executedResult = ExecuteBatch(new TableBatchOperation{operation1, operation2});

I got an exception saying there could not be any retrieve operations in a batch execution. Is there a way to pull this off or is an asynchronous execution the best way to handle multiple partition key, row key look ups? For my use case I will have to look up at most 3 different rows by partition key and row key at the same time.

Teeknow
  • 1,015
  • 2
  • 17
  • 39

1 Answers1

1

Yes, batch operations have certain restrictions and do not include GETS. You can try range queries as outlined here, if the partition key remains the same.

Windows Azure table access latency Partition keys and row keys selection

Otherwise, you can query in parallel.

Community
  • 1
  • 1
hocho
  • 1,753
  • 1
  • 11
  • 14
  • Whoops I made a dupe of that question. I can't really do a query for a range of row keys because I could end up wanting the first and last keys in a partition. I think a query in parallel might end up being the best way to go. Is that the same as an asynchronous call to azure? If it's not can you tell me or point me to a source which has the difference? Can you throw this link (or a better one) in your answer for later visitors: http://social.msdn.microsoft.com/Forums/windowsazure/en-us/d573a17b-2221-4c10-80bc-83b12e863c7d/parallel-queries-to-azure-table-storage?forum=windowsazuredata – Teeknow Jan 28 '14 at 02:22
  • Yes, parallel calls are made asynchronous but need to be made simultaneously to be parallel. There should be many examples for querying in parallel. You can also look into using the TPL as it a good way to abstract away from using threads directly. http://msdn.microsoft.com/en-us/library/dd537609.aspx. If you need to run only 3 queries returning back single rows, parallelizing may not give the best performance and sequential processing may suffice. Parallel calls make more sense if you have many of them and/or they perform complex queries, returning large number of rows. – hocho Jan 28 '14 at 04:29