LSIs have a maximum size of collection - 10 GB. Favor GSIs (Global Secondary Indexes) over LSIs (Local Secondary Indexes).This way they'll fit for multiple use cases and you'll be able to adapt to the new business requirements without altering your table definition. Prefer generic GSI attribute names, something like gsi1_pk, gsi2_sk, etc.For most applications, three GSIs are enough. This is especially important if you're going with Single-Table design. Plan your access patterns first, so you'll know what GSIs to create.This will reduce the likelihood of throttling Isolate frequently accessed items so they won't reside on the same partition. Use keys with high cardinality to avoid hot keys/partitions problem.They enable you sorting within one partition, they enable filtering without using FilterExpressions They offer more functionality without downsides.
Favor composite keys over simple keys.It causes an intensified load on one of the partitions, while others are accessed much less often.
What is a hot key? It's an item with the key that is accessed much more frequently than the rest of the items. If your application will not access the keyspace uniformly, you might encounter the hot partition problem also known as hot key. If you create a table with Local Secondary Index, that table is going to have a 10GB size limit per partition key value.Ĭhoosing the right keys is essential to keep your DynamoDB tables fast and performant.All LSIs must be specified on table creation.