Query on Azure Table Storage's partition key
I am aware that records in azure table storage is organized by PartitionKey and indexed by RowKey. My application requires that I query the records in table storage based on the date range of the TimeStamp. I have couple of thousands records in the table storage and naturally the performance is extremely slow. The reason being, TimeStamp is not indexed. As I understand, PartitionKey is essentially a conversion of the TimeStamp in Ticks. Corr开发者_JAVA技巧ect me if I am wrong.
If this is true, how can I query the table storage on PartitionKey instead of TimeStamp field and improve the performance.
The timestamp record is really for azure's internal use, you don't want to use it for your business logic.
IF you currently have an arbitrary primary key then you could make the primary key be a datetime of your own handling (using the rowkey to ensure uniqueness). If it needs to be updated when you run an update, as per the actual timestamp, then you could update using a delete and re-insert pattern.
If the current primary and row keys are important then create a lookup table. I.e. a table that just has the timestamp as the primary key and the primary key of your other table as it's rowkey. Then you can use this table to find the records you need from the main table.
You determine your own partition key so it can be what you want.
精彩评论