DocumentDB查询需要意外的RU高 [英] DocumentDB Query Requires Unexpected High RUs

查看:181
本文介绍了DocumentDB查询需要意外的RU高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对存储在S3文档集合(最高的地区之一)的数据200MB。每个文件的大小大约为300KB。

I have about 200MB of data stored in a S3 document collection (the highest one). Each document is about 300KB in size.

但是,当我跑我的查询,我很惊讶地看到,它需要的RU 7245.81。由于S3是在2500个RU /秒,这个性能不会扩展我的应用程序。

But when I ran my query, I am surprised to see that it requires 7245.81 RUs. Because S3 is at 2500 RUs/Second, this performance won't scale for my application.

我只想问,如果我做错什么,如果有什么我可以做些什么来改善呢?

I just want to ask if I am doing anything wrong and if there is anything that I can do to improve it?

我的查询是这样的:

SELECT item.Id,item.Priority, va.something, wa.something... 11 fields in total
FROM model.Item item 
JOIN va in item.Content.Children 
JOIN wa in va.Children 
WHERE item.State != 5

我使用范围作为索引类型。但愿这种影响查​​询的性能?

I am using "Range" as the index type. Would that impact the performance of this query?

推荐答案

使用查询!=将需要扫描的,因为所有的索引条目都必须抬起头来,以消除不等于5.这将导致该值高个RU。只要有可能,请尝试重新编写查询作为平等或范围查询。

Queries using != will require a scan, since all index entries have to be looked up to eliminate the values that are not equal to 5. This will lead to a high RUs. Whenever possible, please try rewriting the query as an equality or a range query.


  1. 如果item.State的可能值的数量是有限的,例如,1-10,那么你可以使用枚举有效的值,也就是说,item.State IN(1,2,3,4,6,7 ,8,9,10)

  2. 如果这是不可能的,请在使用例如范围,item.State> 5或item.State< 5像拉里建议之上。

希望这有助于。请在微软科网arramac如果你想更详细地讨论给我发电子邮件。

Hope this helps. Please email me at arramac at microsoft dot com in case you'd like to discuss in more detail.

这篇关于DocumentDB查询需要意外的RU高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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