- Newest
- Most votes
- Most comments
Well avoiding duplicate redundant data is always a thing :-) Why? Because when there are updates to data you have to maintain the redundant copies.
If you use the attribute projections ALL on the GSI you let DynamoDB worry about the housekeeping.
ConsistentReads
are mainly a worry when you write and immediately read back data from the table/index.
So the case to worry about:
- You write InStock=false to a record
- You read all items with inStock=true from the GSI
There could be a short period of time where you could get an item that is actually out of stock. Does not have to be a problem.
In single table design you could add separate records to the same table:
PartitionKey - InStock SortKey - UniqueIdOfItem
These records would never be updated but only inserted/deleted. You query them to get (a page) the UniqueIdOfItem if the items in stock. Using that list of ids you can fetch the details of the items
Regards, Jacco
Relevant content
- asked 4 months ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 3 months ago