Book Image

DynamoDB Applied Design Patterns

By : Uchit Hamendra Vyas
Book Image

DynamoDB Applied Design Patterns

By: Uchit Hamendra Vyas

Overview of this book

Table of Contents (17 chapters)
DynamoDB Applied Design Patterns
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Best practices with secondary indexes


There are four rules to create the secondary index so that our table will function without any hiccups. These rules are as follows:

  • Distributing the load by choosing the correct key

  • Making use of the sparse index

  • Using the global secondary index for quicker retrieval

  • Creating a read replica

Distributing the load by choosing the correct key

In the case of a multipartition table, the data as well as the table's associated indexes will be distributed across servers. This distribution of indexes across servers is determined by the value of one of the attributes of the index. Yes, you're correct: it is decided by the hash key value. Unlike the hash key value (compounded with the range key) of a table, indexes keys can be duplicated. In the case of local secondary indexes, this problem will not occur because of the fact that the table's hash key is the same as that of the index, so the index will be distributed similar to the table. Therefore, this practice must...