在Azure存储查询执行速度很慢 [英] Query execution on azure storage is very slow

查看:160
本文介绍了在Azure存储查询执行速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对查询timestamp列在蔚蓝的表存储。我有检查,如果输入的值大于时间戳值的WHERE条件。蔚蓝的时间戳列不是分区键或行键。我才知道对查询是不分区或行键将减少查询执行的性能列。我的应用程序很慢,当有越来越多的记录。我试着动时间戳数据分区键数据,但分区键不接受像时间戳值2016年4月13日上午05时20分03秒+00:00。什么会提高查询性能的最佳选择。

I am trying to query against timestamp column on a azure table storage. I have a where condition which checks if input value is greater than timestamp value. azure Timestamp column is not a partition key or row key. I came to know querying against column which is not partition or row key will decrease performance of the query execution. My application is very slow when there are more and more records. 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". What would be the best option to increase query performance.

推荐答案

正如你已经提到,如果查询不包括 PartitionKey 和/或 RowKey 的质疑,因为表的服务做全表扫描很慢。建议是使用日期/时间值 PartitionKey 值。

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.

我试着动时间戳数据分区的关键数据,但分区
  关键是不接受类似2016年4月13日上午05时20分03秒的时间标记值
  +00:00

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"

这是因为该值包含不允许的字符(<一个href=\"https://msdn.microsoft.com/en-us/library/azure/dd179338.aspx\">https://msdn.microsoft.com/en-us/library/azure/dd179338.aspx - >见重点领域部分)不允许的字符

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:


  • 您可以格式化 YYYY-MM-DDTHH您的日期/时间值:MM:SS 格式

  • 您可以将日期/时间值转换为蜱和prePEND一些零点前和保存,对PartitionKey。是这样的:

  • 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值= YourDateTimeValue.Ticks.ToString(D19);

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");

您也可以找到这个有用的:<一href=\"https://azure.microsoft.com/en-in/documentation/articles/storage-table-design-guide/\">https://azure.microsoft.com/en-in/documentation/articles/storage-table-design-guide/.

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

这篇关于在Azure存储查询执行速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆