在Azure存储查询执行速度很慢

编程入门 行业动态 更新时间:2024-10-28 12:23:28
本文介绍了在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"

这是因为该值包含不允许的字符(msdn.microsoft/en-us/library/azure/dd179338.aspx - >见重点领域部分)不允许的字符

This is because the value contains characters that are not allowed (msdn.microsoft/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");

您也可以找到这个有用的:azure.microsoft/en-in/documentation/articles/storage-table-design-guide/.

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

更多推荐

在Azure存储查询执行速度很慢

本文发布于:2023-10-23 00:31:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519206.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:速度很慢   Azure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!