I am querying ATS using the following logic:
var query = from m in context.CreateQuery<MyTable>(tableName)
where m.PartitionKey.CompareTo(partitionKey) == 0
select m;
var results = new List<MyTable>();
CloudTableQuery<MyTable> messageTableQuery = (CloudTableQuery<MyTable>)query.AsTableServiceQuery();
ResultContinuation rc = null;
do
{
var asyncResult = rc == null ? messageTableQuery.BeginExecuteSegmented(null, null) :
messageTableQuery.BeginExecuteSegmented(rc, null, null);
ResultSegment<MyTable> result = messageTableQuery.EndExecuteSegmented(asyncResult);
results.AddRange(result.Results);
rc = result.ContinuationToken;
} while (rc != null);
return results;
This seems to return in a reasonable amount of time when I point to my dev ATS, but it takes a painfully long amount of time when I point to prod ATS which contains millions of partitions. My question is, is there any way I can query the ATS in a more efficient way?
My query doesn't necessarily need to get all the row keys with in a partition key. I just need a subset of them.