简体   繁体   中英

How bulk delete all records without TTL from dynamodb?

As the question says, I have about 200million data records in a table in dynamoDB. I am writing a script in nodejs that needs to delete all data without a TTL. I have 3 ideas for this, and I am curious on thoughts about how I should go about doing this on so many records.

  1. batchWrite, this option I would scan then paginate through the whole table, deleting each record as it meets the condition of not currently having a ttl

  2. push all records that dont have a ttl to a new table and then delete that table all at once

  3. set a ttl for records that dont have one, but I cant find any information if this is even a thing or if I can somehow bulk add a ttl to all records without one

Any information is helpful, please let me know how I can go about doing this! Thank you

I would go with option 1 -

Check Parallel Scan doc, pasting some information here.

Segment — A segment to be scanned by a particular worker. Each worker should use a different value for Segment.
TotalSegments — The total number of segments for the parallel scan. This value must be the same as the number of workers that your application will use.

Here, each segment will work on each partition DDB has made on your table. Each partition in DDB is of 10GB. With scanning/ read made faster, we can now perform deletes using BatchWrites .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM