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 ...

Get DynamoDB Applied Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.