A couple noob questions regarding to database

I’m using Nextcloud docker with mariadb’s database.

Just wondering, if I deleted some files, should I manually clean the mariadb database and Nextcloud memories once in a while? Or there is any kind of auto scanning in Nextcloud will handle it?

Another question, is there any official documentation can tell us about the recommended setup for docker Nextcloud regarding to scanning? I know there are already a couple common methods to do periodic scanning (such as new cron container and cron jobs in system), but just want to know if there is already a recommended method documented somewhere.

Thank you.

You don’t have to work manually on the database each time you delete a file. It is handled automatically and instantaniously. Same with memories, you don’t have to scan each time you add/modify/delete files via the web UI.

The main use case of manual scan, is when you add or remove files directly on the server, like doing a cp command from your shell. When you do that, you need to wait for the cron job to happen, or you need to rescan with :
docker exec -u 33 -it nextcloud_data php occ files:scan user

Here is the documentation about cron jobs :
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/background_jobs_configuration.html?highlight=cron

Thanks!!!
Edit:
More answers about cron for nextcloud docker:

nevertheless after i wrote the comment above i found this article in german https://www.projekt-rootserver.de/cron-events-in-docker-containern-zum-laufen-bringen/2019/09/ it says: don’t do it with busybox. not a good idea. the authors advice: use the host cron + docker exec
Source: Docker setup & cron - #8 by Reiner_Nippes