Oc_filecache.ibd very large

Nextcloud version (eg, 20.0.5): 21.0.0 RC1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 8.0.2

The issue you are facing:

oc_filecache.ibd is very large.
I had an external SMB storage mounted that had a large number of files/folders on it.

I’ve removed the external storage mount and ran

occ files:cleanup

but the db is still 5.58GB which I think is slowing down the loading of the webpage significantly.

Is there any way to reduce the size of this file?

Thanks.

No, there isn’t. The database contains all files available on your file system and therefore cannot be reduced.

No, I think you’re wrong. At first the database is handle by your database server and not Nextcloud. Next a significant part of a database is usually hold in memory and not always loaded from the hard disk. Furthermore caching mechanisms exist to reduce file i/o and speed-up your database server access. And finally only the file information is usually hold in memory which is accessed and required and not the whole content of the mentioned database table.

1 Like

It depends if the number of entries in the cache is around the number of files/folders of the external storage. There were some reports that indicate that there could be a bug somewhere with external storages:

If you removed it, check if you have still a reference in the oc_storages table. You can check the associated id, if you have entries from this storage in your oc_filecache.

you check the number of entries per storage:
SELECT storage, COUNT(*) FROM oc_filecache GROUP BY storage;