Delete notifications after days - suggested new setting

Having a setting similar to the ‘delete email logs after days’ but for notifications (hard delete) would be very useful - with the default being 0 (disabled/keep forever).

Although it is nice to have a full history of notifications, the value of them decreases significantly with time and they are somewhat ephemeral. But can eat up quite significant space in the DB proportional to everything else.

From my understanding it’s quite common for social media platforms to not store notifications indefinitely - often a weeks to months range.

My poor server is being thrashed and disk space is filling up rapidly. :okay:

Hope this is considered! :content: :pray:

Reference: 2.8b notifications - is hard deleting old alerts/notifications from the database possible?

1 Like

Does the existing max_notifications_per_user site setting help here? It is a hidden setting but it does a similar job, it limits the total number of notifications on an instance.

That setting by default will keep the last 10,000 notifications per user, and automatically purge the rest in a background job that runs every week. You could lower it to a smaller number (1000 maybe?) and then it’ll clean up even more aggressively.

Context via the original commit: FEATURE: limit number of notifications per user to 10,000 · discourse/discourse@372f6f4 · GitHub