0
votes

I have Dynamodb table whose primary key is partition key. This table has "created date" column also. I want to query this table to fetch top 100 records in descending order by created date. Query must have -key-condition-expression which will accept primary key of this table and it will always return maximum single record. How can I write to fetch top 100 records?

1

1 Answers

0
votes

Have you read the documentation for Dynamo?

It's not an RDBMS...

In order to get more than 1 record out of DDB, you need to have a composite key (hash key + sort key)

Without knowing anything else, it sounds like you'll need to create a global secondary index with a composite key where "created date" is the sort key.

Picking the hash key for your GSI is the harder question...