I have a dynamodb table from which I want to delete a large no of items. I found a stackoverflow answer to a similar question where you scan the whole table to collect all the relevant items, then delete them in batch. but in my case the items are too many that they wouldnt fit in memory.
What are the possible solutions in such case?
- Scan the table using lastEvaluatedKey and each time delete 'x' number of items(say 25 or 100). This would only require one scan but is this a valid solution? Does deleting item(s) have any affect on the lastEvaluatedKey for the next iteration?
- Scan multiple times and delete 'x' number of items without using lastEvaluatedKey. This would require many full-table scans. It is definitely a valid solution but i want to avoid it.