Reputation: 9136
I read this document How It Works: DynamoDB Time to Live (TTL).
It is saying that an item which is already expired could still exist as marked it is expired.
In this case, I wonder if I update the TTL attribute to a future time, Dynamodb recognize the update and delay deleting the item to the new TTL or It just delete it with origin TTL?
Items that are past their expiration, but have not yet been deleted can still be updated, and successful updates to change or remove the expiration attribute will be honored.
Actually the above document mentions the case but I am not sure what it means exactly.
Upvotes: 3
Views: 9658
Reputation: 78603
Yes, it will delay the expiration.
The key statement, as you pointed out, is at How It Works: DynamoDB Time to Live (TTL):
Items that are past their expiration, but have not yet been deleted can still be updated, and successful updates to change or remove the expiration attribute will be honored.
So, if you modify the expiration attribute after an item has been queued for expiration but before it has actually been deleted, then the change to the expiration attribute will be honored.
Upvotes: 7
Reputation: 35178
The way in which DynamoDB TTLs function is that you would set an attribute that contains the TTL value, this item would be queued to be removed after the TTL has expired. This process is carried out by the DyanmoDB background scanner.
Depending on the size and activity level of a table, the actual delete operation of an expired item can vary. Because TTL is meant to be a background process, the nature of the capacity used to expire and delete items via TTL is variable (but free of charge). TTL typically deletes expired items within 48 hours of expiration.
This queued action could be carried out shortly after the TTL which gives a window of opportunity to modify the attribute value for your TTL.
If this is modified the value will be respected by the time it is processed by its queued action.
More information is available in the AWS documentation to describe the process of how TTLs work with DynamoDB.
Upvotes: 0