Nextcloud 18 - MariaDB 10.1.44 - Database at 300GB

Did you check which tables where big ? oc_filecache and oc_activity are usually the only one that grow fast.

To reduce oc_activity -> How to reduce OC_Activitiy table
To reduce oc_filecache -> https://github.com/nextcloud/server/issues/7312 (like posted by @Paradox551)