On Thu, Apr 1, 2021 at 7:23 AM Glen Huang <heyhgl@xxxxxxxxx> wrote:
> I'd say that was onerous and you could get the same effect with a
well-crafted query that targetted only those that might possibly expire.
I wish one cron job could rule them all, but since a person can decide to join at any time, her expiration (e.g., after 1 hour) can also happen at any time. So one cron job won’t cut it if a member’s expiration has to bee accurate.
There are indeed a number of moving parts here but I would suggest that setting up a more static data model would be a well advised starting position. Write queries that take the expiration timestamp into account, noting whether the time it represents is in the past or future. The reduced update burden will be a boon for both complexity of the updates themselves as well as for your I/O subsystem that has to handle vacuuming all of those dead tuples.
David J.