问题描述
如果我试试这个:
( RowKey ge '1606780800000' )
我会在一秒钟内返回结果。
但是如果我尝试使用 AND
,仍然像这样使用 RowKey:
( RowKey ge '1606780800000' and RowKey le '1606784400000' )
它一直在加载。
我知道 with OR
it will perform a full scan,但 AND
的情况是否相同?有什么办法可以解决这个问题吗?
解决方法
如果只使用 2 RowKeys with AND
操作符(没有 PartitionKey),它会做表扫描。
这里有一些建议:
1.如果可能,您可以使用 range query。然后您可以指定过滤器,如 $filter=PartitionKey eq 'xxx' and RowKey ge '1606780800000' and RowKey le '1606784400000'
。但是如果比 PartitionKeys 多一个,则需要编写多个查询。
2.如果您仍然使用此查询: ( RowKey ge '1606780800000' and RowKey le '1606784400000' )
。此时,如果 requested items
大于 1000,则查询一次最多只能返回 1000 项。因此,在这种情况下,您应该在查询中使用 x-ms-continuation-NextPartitionKey
和 x-ms-continuation-NextRowKey
。有关详情,请参阅 this doc。