Book Image

Mastering DynamoDB

By : Tanmay Deshpande
Book Image

Mastering DynamoDB

By: Tanmay Deshpande

Overview of this book

Table of Contents (18 chapters)
Mastering DynamoDB
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
8
Useful Libraries and Tools
Index

Secondary indexes


A primary key attribute allows us to create, maintain, and access data efficiently. To do so, DynamoDB creates indexes on those primary attributes as we have seen in the previous section. However, sometimes there might be a need to search and access items from attributes that are not part of the primary key. For all such needs, DynamoDB supports secondary indexes that can be created on attributes other than the primary key and can be accessed and searched in a manner similar to the primary key.

A secondary index contains a subset of attributes from the given table having an alternative key to support query operations. Secondary index allows users to search attributes other than the primary key, which makes DynamoDB useful for a varied set of applications. We can create multiple secondary indexes for a given table. If we don't create secondary indexes, the only option to get the item for a certain non-primary key attribute is to scan the complete table, which is a very expensive...