Suspiciously bloated MariaDB database

So I published my script here: GitHub - aurelienpierre/clean-nextloud-s3

It finds orphaned S3 items and DB entries by comparing fileid on both, and removes empty folders from oc_filecache.

My database is down from 1.9 GB to 175 MB, for 301 GB of file storage (125k S3 objects), after the previews have been regenerated. No missing file reported in logs. Nextcloud used storage size matches reported used storage size from AWS S3.

:+1: for all the investigation and workarounds shared with everybody. I just went through the topic to make sure, there are related reports in the bug tracker, so there is a chance it might be eventually fixed one day:
PR for a cleanup routine with occ: Delete previews by charleypaulus · Pull Request #35189 · nextcloud/server · GitHub
The issue itself: Files are not deleted from S3 (primary) · Issue #20333 · nextcloud/server · GitHub