Expiring an entire set using a lua script


Came across this solution in stackoverflow where you can delete entire contents of a set by updating the TTL: Changing TTL for a set in Aerospike with AQL - Stack Overflow

Would like to apply this solution in our production environment where we have records in the range of billions . Above solution creates a scan job in the background.

What would be the performance impact on a cluster with 20 nodes and the set having 4,843,572,506 records ? (Memory, cpu usage, latency etc)

Thanks in advance Sri

Why not use the truncate info command?

In the Enterprise Edition version, this will be durable. If using the Community Edition, records may still resurrect upon restart if deleting records by setting a TTL when they previously had no TTL or were going to expire at a later time. I am therefore curious about the use case for wanting to delete the content of a set by setting a TTL.


Truncate seems like a better option - use case is to shrink the data for a set (which has grown over time) and is consuming quite a bit of memory and diskspace. Once the set is cleared, want to re populate the data using a smaller subset of the original set


Then truncate would definitely be the way to go. You can check the docs, with the config (truncate-threads) and the optional LUT that can be passed.

Thanks Meher. Appreciate the quick responses.