1

Similar questions were asked, but this case is different: I have a huge table in DynamoDB with two indexes: ID and TYPE, and I want to get a single random / incremented result whose TYPE equals to something.

I cannot afford querying ALL the data under this filter of course, so how can I still get a single result so that is each query - the result is different?

Thanks!

Community
  • 1
  • 1
Forepick
  • 919
  • 2
  • 11
  • 31
  • 1
    I don't understand what you mean by "incremented". Also, have you looked at the answers to this question? http://stackoverflow.com/questions/10666364/aws-dynamodb-pick-a-record-item-randomly – Mark B Apr 06 '16 at 18:35
  • "Incremented" means like a round robin. This answer fits me nicely to the "random" case. – Forepick Apr 06 '16 at 18:56
  • Perhaps English isn't your primary language, but "incremented" and "round robin" don't share any meaning in English. Incremented means "added" or "increased". Round Robin means "to take turns". Neither of those terms share a meaning with "random". – Mark B Apr 06 '16 at 19:01
  • well they don't. This is just another method I need to fetch a single record with. I don't have a better phrase to describe "each index should be the one that follows the previous one..." Thanks for the reference anyway :-) – Forepick Apr 06 '16 at 19:31
  • If you need to always get the record in some order ("each index should be the one that follows the previous one"), how is that random in any definition of the word "random"? Perhaps you need to take your last record index ID/timestamp/whatever, and query for the next one that comes after that. However your question is worded so badly I can't really understand it. – Mark B Apr 06 '16 at 19:38
  • What do you mean by "two indexes: ID and TYPE" are those local or global secondary indexes? What is the hash key/range key of your table? And what are the partition keys for the two indexes? And lastly - what does "huge" mean? do you have millions, billions, or trillions of records in the table? huge is too vague.. please update the question as best as you can! – Mike Dinescu Apr 07 '16 at 06:27

0 Answers0