Shubham Agarwal explains how indexing works within DynamoDB:
Global secondary index in DynamoDb – An index with a partition key and a sort key that can be different from the base table. A global secondary index is very helpful when you need to query your data without primary key.
-
The primary key of a global secondary index can be partition key or composite (partition key and sort key).
-
Global secondary indexes can be created at the same time that you create a table. You can also add a new global secondary index to an existing table, or delete an existing global secondary index
-
A global secondary index lets you query over the entire table, across all partitions.
-
The index partition key and sort key (if present) can be any base table attributes of type string, number, or binary.
-
With global secondary index queries or scans, you can only request the attributes that are projected into the index. DynamoDB will not fetch any attributes from the table.
-
There are no size restrictions for global secondary indexes.
Click through to learn more about these as well as local secondary indexes.