Excessive SSD writes - Nextcloud database issue?

Yesterday I checked my SSD S.M.A.R.T. attributes and I noticed it was was 480 TBW - which is extremely excessive considering the drive is less than 1 year old. I narrowed this down to Nextcloud.

I currently use Nextcloud 16.0.5 on an unRAID server using the linuxserver.io docker. I have a fairly basic, out of the box setup along with the performance tweaks that are in the official Nextcloud documentation.

Basically the excessive writes start about 6 hours after starting Nextcloud and my MariaDB binlog looks like this once the writes ramp up. These writes continue perpetually at about 200-250 mb/s. This is a big issue for me and and I am not sure how to prevent it.

[Several lines here]
# Number of rows: 1
# at 97428701
# at 97429112
#191117  4:25:04 server id 1  end_log_pos 97429112 CRC32 0xe4325a48     Annotate_rows:
#Q> UPDATE `oc_filecache` SET `mtime` = '1573982704', `etag` = '05d7b84ff4619afc78fc0f4f087d3fd8', `storage_mtime` = '1573982704', `checksum`='' WHERE (`mtime` <> '1573982704' OR `etag` <> '05d7b84ff4619afc78fc0f4f087d3fd8' OR `storage_mtime` <> '1573982704' OR `checksum` <> '' OR `mtime` IS NULL OR `etag` IS NULL OR `storage_mtime` IS NULL OR `checksum` IS NULL) AND `fileid` = '163718282'
#191117  4:25:04 server id 1  end_log_pos 97429198 CRC32 0x5ae44186     Table_map: `nextcloud`.`oc_filecache` mapped to number 34
# at 97429198
#191117  4:25:04 server id 1  end_log_pos 97430666 CRC32 0x5b9683fd     Update_rows: table id 34 flags: STMT_END_F

After looking at what the fileid was in the oc_filecache table I found that it’s a file that should not be accessible anymore. It was available by a local external storage mount but was since removed. Why is Nextcloud trying to update records in the database that are not even accessible anymore?

Any suggestions are greatly appreciated. If any specific additional info is needed please let me know.

Did you solve it ?