2

I want to set TTL around 2-3 months so its clearly infeasible to check after every 60 sec for TTL indexex. I want to reduce overhead by checking TTL once in a day. Is there any way to manually/programmatically define this time?

Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
Shailesh
  • 367
  • 1
  • 5
  • 15

1 Answers1

2

Based on my knowledge it is impossible to do this. Some time ago I was looking for this option but have not found anything apart of disabling it completely.

I am inclined to think that this is impossible to modify because in TTL documentation it is told explicitly that:

The background task that removes expired documents runs every 60 seconds.

and there is no parameter in server configuration which makes anything similar.

P.S. I understand that you see this as a waste of resources, but I would start to worry about it only when I will see a bottleneck regarding to it.

P.P.S and if you would found that this is a bottleneck, you can implement your own cleanup (put a script which removes all documents later than some timestamp) and put it once per day on cron job.

Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
  • Thanks Dali. I will create a cron job to do this but I'm afraid whether it will produce a lock issue on the DB or not. – Shailesh Apr 16 '15 at 06:43