Secondary indexes
Primary keys in DynamoDB provide efficient and fast access to items in tables, when we query the items via their primary keys. However, there are a lot of scenarios where we may want to query items in tables via attributes other than the primary keys. DynamoDB allows us to create secondary indexes that target attributes different than primary key attributes. These indexes enable us to run efficient queries on nonprimary key items.
A secondary index is nothing more than a data structure that contains a subset of attributes from a table. A table is allowed to have multiple secondary indexes, which provides flexibility when querying data from tables.
In order to further understand secondary queries, we will need to cover some ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access