I'm writing a simple logging service in DynamoDB.
I have a logs table that is keyed by a user_id
hash and a timestamp
(Unix epoch int) range.
When a user of the service terminates their account, I need to delete all items in the table, regardless of the range value.
What is the recommended way of doing this sort of operation (Keeping in mind there could be millions of items to delete)?
My options, as far as I can see are:
A: Perform a Scan
operation, calling delete on each returned item, until no items are left
B: Perform a BatchGet
operation, again calling delete on each item until none are left
Both of these look terrible to me as they will take a long time.
What I ideally want to do is call LogTable.DeleteItem(user_id)
- Without supplying the range, and have it delete everything for me.