Local Secondary Index

There could be scenarios where we need to look for records that match particular attributes that aren’t part of the primary key. This could lead to performance or consumption issues. Let’s explore a solution to this problem called the local secondary index.

Queries with specific attributes

When a record is stored, it has a partition key and, perhaps, a sort key. Let us imagine there is a table with different records, and you are required to find a particular record based on its key. That shouldn’t be a problem, as we can simply send a query with the record’s key. A problem could occur if you’re asked to look for records where an attribute matches a particular criteria that isn’t related to the record’s partition key.

Get hands-on with 1400+ tech skills courses.