1
votes

In my application, the RowKey is a combination of a word + SEPARATOR_CHAR + timestamp. For a given PartitionKey and partial RowKey (which doesn't have the timestamp part), how to efficiently retrieve the entity with biggest timestamp? Is query with partial RowKey supported in Azure Table?

1
Possible duplicate of Fastest way of querying for latest items in a Azure table?user152949

1 Answers

1
votes

If you put the rows in the table with the most recent row having the biggest timestamp, you can do a query for only rows with the first part of your rowkey and take the 1st result using the take option for queries.

To get only the rows with the first part of the rowkey, you can limit the rows you retrieve from the service by using a > filter for and < .

Example:

rows in table (a_2, a_1, b_1)

goal: want all 'a' rows

filters: > a_ & < a` (since ` is after _ on the ascii table)

result: a_2, a_1

If you know the most recent added row with that rowkey is the one you want you can add a 'top=1' to the query to get just a_2.