Nextcloud version: 17.0.1
Operating system and version: Ubuntu 18.04 LTS
Apache or nginx version: Apache 2.4.29
PHP version: 7.2.24
In the past I have mounted a filesystem via External Storage (SMB/CIFS) with a large amount of small backup files. This has led to a large oc_filecache table.
The 10 largest table in my otherwise very small NC instance:
select schemaname as table_schema, relname as table_name, pg_size_pretty(pg_total_relation_size(relid)) as total_size, pg_size_pretty(pg_relation_size(relid)) as data_size, pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as external_size from pg_catalog.pg_statio_user_tables order by pg_total_relation_size(relid) desc, pg_relation_size(relid) desc limit 10;
I have unmounted this filesystem. There are approx 27 million entries in oc_filecache and 95% of them are releated to his particular filesystem (
select count(*) from oc_filecache where storage=13). After unmounting the filesystem, the related entry in the oc_storages table remained (numeric_id=13). Not sure if this is deliberate, but currently the case.
I have searched the forum on ways how to get rid of these now obsolete entries in oc_filecache, to make it smaller again. Have tried occ files:cleanup. But to my information this only deletes entries in oc_filecache for there is no entry in oc_storages. As since there is still an entry for this filesystem, nothing gets cleaned up.
Have tried copying the table oc_filecache to oc_filecache_temp (without the entries for storage=13). After that I rename oc_filecache to oc_filecache_orig and oc_filecache_temp to oc_filecache.
This seemed to have worked ok, but a day later I noticed issues in syncing and uploading data, so I reverted back to a snapshot from before the oc_filecache manipulation.
Since this table is so out of proportion related to the rest of the tables, I do would like to get this “solved”.
Does anyone have a idea what else I could try?
Thanks a lot in advance!