dimanche 30 août 2015

Dynamodb - Having mulitple rangekey conditions for the same hash key

Could i know if there is a provision of having multiple range key conditions for the same hash key. For example,if the hash key is 'locality' and rangekey is 'shopNo'. Then could we have the below keyconditionset:

>HashKeyCondition: locality EQ  'NewYork'  
>RangeKeyCondition1: shopNo BETWEEN  1 to 10  
>RangeKeyCondition2: shopNo BETWEEN  20 to 30

When the above was tried, it was considering only one rangeKeyCondition . Is there any way that we can achieve giving two rangekeyconditions for the same hashkey. I am supposing that it could be possible since for a given hashkey, all the rangekeys under this partition are indexed via a 'sortedindex'.

I can see this can be achieved using a 'QueryFilter' with 'OR' ConditionalOperator but the filter is applied after the key-based retrieval and before the results are returned to you. This may not be efficient, as getting all shopNo's for a locallity and then performing a filter could be slower than getting the only items which satisfy the provided multiple rangekey conditions

Could anyone advice on how can this be achieved?

Thanks.




Aucun commentaire:

Enregistrer un commentaire