Azure Table Storage get last record

James Reategui picture James Reategui · May 1, 2012 · Viewed 9.1k times · Source

I have an azure table with about 5 million+ rows, each partition about 100k rows. The RowKey is a sortable timestamp. I need to be able to get the latest record that was inserted in the table.

Since Linq Last, Max, OrderBy etc are not supported, how do I efficiently get the most recent table record?

Answer

user94559 picture user94559 · May 1, 2012

There's no efficient way to do this. But if it's an option, consider flipping your row key so that the newest entries are on the top (reverse chronological order). Retrieving the top n entries is easy and efficient.