4
votes

Would there be much difference in the performance, of a Table Storage query, if you knew the exact Partition Key and RowKey?

We use a datetime for the RowKey and to get the latest entry we retrieve everything for a day and then sort it in code.

PartitionKey eq '123456' and RowKey ge '20170713000000000' and RowKey le '20170714000000000' 

Would this retrieve record from table storage quicker?

PartitionKey eq '123456' and RowKey eq '20170713101000000' 
1

1 Answers

5
votes

PartitionKey eq '123456' and RowKey eq '20170713101000000'

This query will definitely be faster than

PartitionKey eq '123456' and RowKey ge '20170713000000000' and RowKey le '20170714000000000'

The first query makes use of all the available indexes (PartitionKey and RowKey) and is a point query.

The second query is also efficient (though not as much as the 1st one) because it is only searching in a single partition however it is doing what is known as Partition Scan. This query will go to the desired partition and then perform a search for matching RowKey values. As the number of entities in a partition grow, you will notice a degradation in performance in the 2nd query.