0

If I try this:

( RowKey ge '1606780800000' )

I get results back in one second.

But if I try with AND, still using RowKey like this:

( RowKey ge '1606780800000' and RowKey le '1606784400000' )

It keeps loading forever.

I know that with OR it will perform a full scan, but is the same case with AND? Any way to go around this?

rlcabral
  • 1,496
  • 15
  • 39
  • how many of the results that should be returned? Regarding "It keeps loading forever.", you mean no results returned? – Ivan Glasenberg Dec 25 '20 at 01:50
  • @IvanYang I mean it keeps waiting for the results to come, but since there is too much data to scan, it stays there "forever". After half hour I just give up. – rlcabral Dec 25 '20 at 22:22

1 Answers1

1

If just using 2 RowKeys with AND operator(without PartitionKey),it will do table scan.

Here are some suggestions:

1.You can use range query if possible. Then you can specify the filter like $filter=PartitionKey eq 'xxx' and RowKey ge '1606780800000' and RowKey le '1606784400000'. But you need to write more than one queries if there're one more than PartitionKeys.

2.If you still use this query: ( RowKey ge '1606780800000' and RowKey le '1606784400000' ) . At this time, if the requested items are more than 1000, the query can only return a maximum of 1000 items at one time. So in this case, you should use x-ms-continuation-NextPartitionKey and x-ms-continuation-NextRowKey in your query. See this doc for more details.

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60
  • I am going to accept this as answer because it answers my question whether it performs a table scan or not. Now I know, and this explains why it takes so long. Also, your suggestions may help others. In my particular case does not help because it wouldn't be practical. I would have to run the query around 12000 times to cover all possible PartitionKey. Since the period I wanted to query is recent, I just fetched all rows since a certain day, and then I programmatically discarded the rows I didn't want. – rlcabral Dec 25 '20 at 22:28