Query execution on azure storage is very slow

柔情痞子 提交于 2019-12-04 21:14:34

As you have mentioned already, if a query doesn't include PartitionKey and/or RowKey the queries will be slow because Table service is doing full table scan. Recommendation would be to use the date/time value as PartitionKey value.

I tried to move time stamps data to partition key data but partition key is not accepting time stamp value like "4/13/2016 5:20:03 AM +00:00"

This is because the value contains characters that are not allowed (https://msdn.microsoft.com/en-us/library/azure/dd179338.aspx --> see Characters Disallowed in Key Fields section).

There're actually a number of things you could do to solve this problem:

  • You can format your date/time value in YYYY-MM-DDThh:mm:ss format.
  • You can convert the date/time value to ticks and prepend some zeros in front and save that for PartitionKey. Something like:

    PartitionKey Value = YourDateTimeValue.Ticks.ToString("d19");

If you want the most recent entries to come on the top, you could do something like:

PartitionKey Value = (DateTime.MaxValue.Ticks - YourDateTimeValue.Ticks).ToString("d19");

You may also find this useful: https://azure.microsoft.com/en-in/documentation/articles/storage-table-design-guide/.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!