Home > Mobile >  AWS DynamoDb: Does KeySchema create internal index?
AWS DynamoDb: Does KeySchema create internal index?

Time:07-18

For Dynamodb, Does setting KeySchema automatically create a primary index? Or need to use GlobalSecondaryIndexes to create index?

CodePudding user response:

No, there is no primary index on a DynamoDB table. Setting the key schema creates a primary key.

If your primary key is composite, i.e. comprises both a partition key and a sort key, then you can retrieve items for a given partition key ordered by the sort key.

CodePudding user response:

It's not explicitly mentioned in the documentation that an index is created for Primary KeySchema. However, if we look at the access patterns using Sort Key, it can be easily understood that an internal index is maintained for supporting access patterns like begins_with. Checkout this for more details in access patterns using Sort keys.

Creating an alternate sort key or local secondary index also support internal index argument for Primary KeySchema with Sort Key (like an index for alternate Sort key).

  • Related