skip to Main Content

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

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search