AWS DynamoDB – Create a Global Secondary Index
Amazon DynamoDB is a NoSQL-managed database that stores data in the form of key-value pairs and document data. A Dynamodb table stores items which are nothing but key-value pairs. By default, each item will have a partition key to differentiate between the items.
When need to perform many kinds of queries, taking different attributes as query criteria, then you can create one or more global secondary indexes and issue Query requests against these indexes in Amazon DynamoDB.
For example, a table named movies have been created in DynamoDB. See the below image:
Create a global secondary index:
To create a secondary index in DynamoDB follow the below simple steps:
Step 1: Click on the name of the table. Navigate to the Indexes tab of the table. Click on create index button.
Step 2: Provide the primary key name. In this case, we have provided the Name. The index name is more of a table name. Thus, when we add a secondary global index and the results obtained upon query are stored in the specified index name. Rest leave everything as default. Click create index button.
In the above images, we see that a secondary global index has been created with the name Name-index.
Please Login to comment...