Local secondary indexes
As covered in the introduction to this chapter, LSIs were the first type of secondary indexes available for DynamoDB tables. These were introduced based on customer feedback to provide an alternative view of the same DynamoDB table data. However, the data itself was indexed by the same partition key as that of the base table. The key difference between LSIs and base tables themselves was that LSIs could use a different sort key attribute than that of the base table. In other words, LSIs indexed the base table data by the same partition key but sorted the same data by a different attribute than the sort key of the base table, providing an alternative sorting capability for the DynamoDB data.
If you need your e-wallet transaction data sorted by a creation timestamp as well as transaction value, you can leverage an LSI to sort the same transaction data by two different attributes but indexed by the same partition key (i.e., walletID
). Now, you can provide the...