I want to sort items identified by the same partition key using different sort keys.
In that case, a LSI seems to be the perfect fit, but would I get any benefits by using a GSI instead? (which would then use the same PK as the table). I don't care about consistency (maybe I should?) and I'm more focused on flexibility of use and overall price.
Any guidance?
CodePudding user response:
You have to pay extra for a GSI, you don't for an LSI.
In addition, as you mentioned a GSI is eventually consistent with the table.
However, a table with LSIs is limited 10GB per partition
See Quotas - Partition Keys and Sort Keys
In general, there is no practical limit on the number of distinct sort key values per partition key value.
The exception is for tables with secondary indexes. With a local secondary index, there is a limit on item collection sizes: For every distinct partition key value, the total sizes of all table and index items cannot exceed 10 GB. This might constrain the number of sort keys per partition key value. For more information, see Item Collection Size Limit.
The Item Collection Size limit
The maximum size of any item collection is 10 GB. This limit does not apply to tables without local secondary indexes. Only tables that have one or more local secondary indexes are affected.