4
votes

I'm trying to retrieve all of the keys from a DynamoDB table in an optimized way. There are millions of keys.

In Cassandra I would probably create a single row with a column for every key which would eliminate to do a full table scan. DynamoDBs 64k limit per Item would seemingly preclude this option though.

Is there a quick way for me to get back all of the keys?

Thanks.

1

1 Answers

2
votes

I believe the DynamoDB analogue would be to use composite keys: have a primary key of "allmykeys" and a range attribute of the originals being tracked: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/DataModel.html#DataModelPrimaryKey

I suspect this will scale poorly to billions of entries, but should work adequately for a few million.

Finally, again as with Cassandra, the most straightforward solution is to use map/reduce to get the keys: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/EMRforDynamoDB.html