nextcloud / nextcloud/server

[Bug]: Excessive database usage while deleting single file

Open
#44,853 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 27-feedback bug feature: filesystem feature: trashbin performance 🚀
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Deleting a single file causes lots of database queries. This feels wrong.

 replica  0 SELECT `appid`, `configkey`, `configvalue`, `type` FROM `oc_appconfig` WHERE `lazy` = :dcValue1
 replica  0 SELECT `uid`, `displayname`, `password` FROM `oc_users` WHERE `uid_lower` = :dcValue1
 replica  0 SELECT `gu`.`gid`, `g`.`displayname` FROM `oc_group_user` `gu` LEFT JOIN `oc_groups` `g` ON `gu`.`gid` = `g`.`gid` WHERE `uid` = :dcValue1
 replica  0 SELECT `provider_id`, `enabled` FROM `oc_twofactor_providers` WHERE `uid` = :dcValue1
 replica  0 SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = :dcValue1
 replica  0 UPDATE `oc_preferences` SET `configvalue` = :dcValue1 WHERE (`userid` = :dcValue2) AND (`appid` = :dcValue3) AND (`configkey` = :dcValue4)
 primary  0 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
 primary  0 SET SESSION AUTOCOMMIT=1
 primary  0 SELECT `credentials` FROM `oc_storages_credentials` WHERE (`identifier` = :dcValue1) AND (`user` = :dcValue2)
 primary  0 SELECT `id`, `numeric_id`, `available`, `last_checked` FROM `oc_storages` WHERE `id` = :dcValue1
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `m`.`mount_id`, `mount_point`, `storage_backend`, `auth_backend`, `priority`, `m`.`type` FROM `oc_external_mounts` `m` INNER JOIN `oc_external_applicable` `a` ON `m`.`mount_id` = `a`.`mount_id` WHERE ((`a`.`type` = :dcValue1) AND (`a`.`value` IS NULL)) OR ((`a`.`type` = :dcValue2) AND (`a`.`value` = :dcValue3)) OR ((`a`.`type` = :dcValue4) AND (`a`.`value` IN (:dcValue5)))
 primary  0 SELECT `id`, `numeric_id`, `available`, `last_checked` FROM `oc_storages` WHERE `id` IN (:dcValue1)
 primary  0 SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner` FROM `oc_share_external` WHERE (`user` = :dcValue1) AND (`accepted` = :dcValue2)
 primary  0 SELECT `s`.*, `f`.`fileid`, `f`.`path`, `f`.`permissions` as `f_permissions`, `f`.`storage`, `f`.`path_hash`, `f`.`parent` as `f_parent`, `f`.`name`, `f`.`mimetype`, `f`.`mimepart`, `f`.`size`, `f`.`mtime`, `f`.`storage_mtime`, `f`.`encrypted`, `f`.`unencrypted_size`, `f`.`etag`, `f`.`checksum`, `st`.`id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s`.`file_source` = `f`.`fileid` LEFT JOIN `oc_storages` `st` ON `f`.`storage` = `st`.`numeric_id` WHERE (`share_type` = :dcValue1) AND (`share_with` = :dcValue2) AND ((`item_type` = :dcValue3) OR (`item_type` = :dcValue4)) ORDER BY `s`.`id` ASC
 primary  0 SELECT `id`, `mimetype` FROM `oc_mimetypes`
 primary  0 SELECT `s`.*, `f`.`fileid`, `f`.`path`, `f`.`permissions` as `f_permissions`, `f`.`storage`, `f`.`path_hash`, `f`.`parent` as `f_parent`, `f`.`name`, `f`.`mimetype`, `f`.`mimepart`, `f`.`size`, `f`.`mtime`, `f`.`storage_mtime`, `f`.`encrypted`, `f`.`unencrypted_size`, `f`.`etag`, `f`.`checksum`, `st`.`id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s`.`file_source` = `f`.`fileid` LEFT JOIN `oc_storages` `st` ON `f`.`storage` = `st`.`numeric_id` WHERE (`share_type` = :dcValue1) AND (`share_with` IN (:dcValue2)) AND ((`item_type` = :dcValue3) OR (`item_type` = :dcValue4)) ORDER BY `s`.`id` ASC
 primary  0 SELECT * FROM `oc_share` WHERE (`share_with` = :dcValue1) AND (`share_type` = :dcValue2) AND (`item_type` IN (:dcValue3, :dcValue4))
 primary  0 SELECT `r`.`token` FROM `oc_talk_attendees` `a` LEFT JOIN `oc_talk_rooms` `r` ON `a`.`room_id` = `r`.`id` WHERE (`a`.`actor_id` = :dcValue1) AND (`a`.`actor_type` = :dcValue2)
 primary  0 SELECT `s`.*, `f`.`fileid`, `f`.`path`, `f`.`permissions` as `f_permissions`, `f`.`storage`, `f`.`path_hash`, `f`.`parent` as `f_parent`, `f`.`name`, `f`.`mimetype`, `f`.`mimepart`, `f`.`size`, `f`.`mtime`, `f`.`storage_mtime`, `f`.`encrypted`, `f`.`unencrypted_size`, `f`.`etag`, `f`.`checksum`, `st`.`id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s`.`file_source` = `f`.`fileid` LEFT JOIN `oc_storages` `st` ON `f`.`storage` = `st`.`numeric_id` WHERE (`s`.`share_type` = :dcValue1) AND (`s`.`share_with` IN (:dcValue2)) AND ((`s`.`item_type` = :dcValue3) OR (`s`.`item_type` = :dcValue4)) ORDER BY `s`.`id` ASC
 primary  0 SELECT * FROM `oc_share` WHERE (`share_type` = :dcValue1) AND (`share_with` = :dcValue2) AND ((`item_type` = :dcValue3) OR (`item_type` = :dcValue4))
 primary  0 SELECT `storage_id`, `root_id`, `user_id`, `mount_point`, `mount_id`, `mount_provider_class` FROM `oc_mounts` `m` WHERE `user_id` = ?
 primary  1 INSERT INTO `oc_mounts` (`storage_id`,`root_id`,`user_id`,`mount_point`,`mount_id`,`mount_provider_class`) SELECT ?,?,?,?,?,? FROM `oc_mounts` WHERE `root_id` = ? AND `user_id` = ? AND `mount_point` = ? HAVING COUNT(*) = 0
 primary  1 INSERT INTO `oc_mounts` (`storage_id`,`root_id`,`user_id`,`mount_point`,`mount_id`,`mount_provider_class`) SELECT ?,?,?,?,?,? FROM `oc_mounts` WHERE `root_id` = ? AND `user_id` = ? AND `mount_point` = ? HAVING COUNT(*) = 0
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `data` FROM `oc_accounts` WHERE `uid` = :uid
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT * FROM `oc_properties` WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` in (?)
 replica  0 SELECT `appid`, `configkey`, `configvalue`, `type` FROM `oc_appconfig` WHERE `lazy` = :dcValue1
 replica  0 SELECT `uid`, `displayname`, `password` FROM `oc_users` WHERE `uid_lower` = :dcValue1
 replica  0 SELECT `gu`.`gid`, `g`.`displayname` FROM `oc_group_user` `gu` LEFT JOIN `oc_groups` `g` ON `gu`.`gid` = `g`.`gid` WHERE `uid` = :dcValue1
 replica  0 SELECT `provider_id`, `enabled` FROM `oc_twofactor_providers` WHERE `uid` = :dcValue1
 replica  0 SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = :dcValue1
 replica  0 SELECT `credentials` FROM `oc_storages_credentials` WHERE (`identifier` = :dcValue1) AND (`user` = :dcValue2)
 replica  0 SELECT `id`, `numeric_id`, `available`, `last_checked` FROM `oc_storages` WHERE `id` = :dcValue1
 replica  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 replica  0 SELECT `m`.`mount_id`, `mount_point`, `storage_backend`, `auth_backend`, `priority`, `m`.`type` FROM `oc_external_mounts` `m` INNER JOIN `oc_external_applicable` `a` ON `m`.`mount_id` = `a`.`mount_id` WHERE ((`a`.`type` = :dcValue1) AND (`a`.`value` IS NULL)) OR ((`a`.`type` = :dcValue2) AND (`a`.`value` = :dcValue3)) OR ((`a`.`type` = :dcValue4) AND (`a`.`value` IN (:dcValue5)))
 replica  0 SELECT `id`, `numeric_id`, `available`, `last_checked` FROM `oc_storages` WHERE `id` IN (:dcValue1)
 replica  0 SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner` FROM `oc_share_external` WHERE (`user` = :dcValue1) AND (`accepted` = :dcValue2)
 replica  0 SELECT `s`.*, `f`.`fileid`, `f`.`path`, `f`.`permissions` as `f_permissions`, `f`.`storage`, `f`.`path_hash`, `f`.`parent` as `f_parent`, `f`.`name`, `f`.`mimetype`, `f`.`mimepart`, `f`.`size`, `f`.`mtime`, `f`.`storage_mtime`, `f`.`encrypted`, `f`.`unencrypted_size`, `f`.`etag`, `f`.`checksum`, `st`.`id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s`.`file_source` = `f`.`fileid` LEFT JOIN `oc_storages` `st` ON `f`.`storage` = `st`.`numeric_id` WHERE (`share_type` = :dcValue1) AND (`share_with` = :dcValue2) AND ((`item_type` = :dcValue3) OR (`item_type` = :dcValue4)) ORDER BY `s`.`id` ASC
 replica  0 SELECT `id`, `mimetype` FROM `oc_mimetypes`
 replica  0 SELECT `s`.*, `f`.`fileid`, `f`.`path`, `f`.`permissions` as `f_permissions`, `f`.`storage`, `f`.`path_hash`, `f`.`parent` as `f_parent`, `f`.`name`, `f`.`mimetype`, `f`.`mimepart`, `f`.`size`, `f`.`mtime`, `f`.`storage_mtime`, `f`.`encrypted`, `f`.`unencrypted_size`, `f`.`etag`, `f`.`checksum`, `st`.`id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s`.`file_source` = `f`.`fileid` LEFT JOIN `oc_storages` `st` ON `f`.`storage` = `st`.`numeric_id` WHERE (`share_type` = :dcValue1) AND (`share_with` IN (:dcValue2)) AND ((`item_type` = :dcValue3) OR (`item_type` = :dcValue4)) ORDER BY `s`.`id` ASC
 replica  0 SELECT * FROM `oc_share` WHERE (`share_with` = :dcValue1) AND (`share_type` = :dcValue2) AND (`item_type` IN (:dcValue3, :dcValue4))
 replica  0 SELECT `r`.`token` FROM `oc_talk_attendees` `a` LEFT JOIN `oc_talk_rooms` `r` ON `a`.`room_id` = `r`.`id` WHERE (`a`.`actor_id` = :dcValue1) AND (`a`.`actor_type` = :dcValue2)
 replica  0 SELECT `s`.*, `f`.`fileid`, `f`.`path`, `f`.`permissions` as `f_permissions`, `f`.`storage`, `f`.`path_hash`, `f`.`parent` as `f_parent`, `f`.`name`, `f`.`mimetype`, `f`.`mimepart`, `f`.`size`, `f`.`mtime`, `f`.`storage_mtime`, `f`.`encrypted`, `f`.`unencrypted_size`, `f`.`etag`, `f`.`checksum`, `st`.`id` AS `storage_string_id` FROM `oc_share` `s` LEFT JOIN `oc_filecache` `f` ON `s`.`file_source` = `f`.`fileid` LEFT JOIN `oc_storages` `st` ON `f`.`storage` = `st`.`numeric_id` WHERE (`s`.`share_type` = :dcValue1) AND (`s`.`share_with` IN (:dcValue2)) AND ((`s`.`item_type` = :dcValue3) OR (`s`.`item_type` = :dcValue4)) ORDER BY `s`.`id` ASC
 replica  0 SELECT * FROM `oc_share` WHERE (`share_type` = :dcValue1) AND (`share_with` = :dcValue2) AND ((`item_type` = :dcValue3) OR (`item_type` = :dcValue4))
 replica  0 SELECT `storage_id`, `root_id`, `user_id`, `mount_point`, `mount_id`, `mount_provider_class` FROM `oc_mounts` `m` WHERE `user_id` = ?
 primary  0 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
 primary  0 SET SESSION AUTOCOMMIT=1
 primary  1 INSERT INTO `oc_mounts` (`storage_id`,`root_id`,`user_id`,`mount_point`,`mount_id`,`mount_provider_class`) SELECT ?,?,?,?,?,? FROM `oc_mounts` WHERE `root_id` = ? AND `user_id` = ? AND `mount_point` = ? HAVING COUNT(*) = 0
 primary  1 INSERT INTO `oc_mounts` (`storage_id`,`root_id`,`user_id`,`mount_point`,`mount_id`,`mount_provider_class`) SELECT ?,?,?,?,?,? FROM `oc_mounts` WHERE `root_id` = ? AND `user_id` = ? AND `mount_point` = ? HAVING COUNT(*) = 0
 primary  0 SELECT `data` FROM `oc_accounts` WHERE `uid` = :uid
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(:dcValue1, :dcValue2, :dcValue3)
 primary  0 UPDATE `oc_file_locks` SET `lock` = `lock` + :dcValue1, `ttl` = :dcValue2 WHERE (`key` = :dcValue3) AND (`lock` >= :dcValue4)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `json`, `sync_token` FROM `oc_files_metadata` WHERE `file_id` = :dcValue1
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 UPDATE `oc_file_locks` SET `lock` = :dcValue1, `ttl` = :dcValue2 WHERE (`key` = :dcValue3) AND (`lock` = :dcValue4)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `storage`, `path`, `mimetype` FROM `oc_filecache` WHERE `fileid` = :dcValue1
 primary  0 SELECT `storage_id`, `root_id`, `user_id`, `mount_point`, `mount_id`, `f`.`path`, `mount_provider_class` FROM `oc_mounts` `m` INNER JOIN `oc_filecache` `f` ON `m`.`root_id` = `f`.`fileid` WHERE (`storage_id` = ?) AND (`user_id` = ?)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE `filecache`.`fileid` = :dcValue1
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(:dcValue1, :dcValue2, :dcValue3)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  1 UPDATE `oc_filecache` SET `storage` = :dcValue1, `path` = :dcValue2, `path_hash` = :dcValue3, `name` = :dcValue4, `parent` = :dcValue5 WHERE `fileid` = :dcValue6
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `size`, `unencrypted_size` FROM `oc_filecache` WHERE (`parent` = :dcValue1) AND (`size` >= :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `size`, `unencrypted_size` FROM `oc_filecache` WHERE `parent` = :dcValue1
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `size`, `unencrypted_size` FROM `oc_filecache` WHERE (`parent` = :dcValue1) AND (`size` >= :dcValue2)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 UPDATE `oc_filecache` SET `mtime` = :dcValue4, `storage_mtime` = :dcValue5 WHERE (`fileid` = :dcValue1) AND (((`mtime` <> :dcValue2) OR (`mtime` IS NULL)) OR ((`storage_mtime` <> :dcValue3) OR (`storage_mtime` IS NULL)))
 primary  0 SELECT `path` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`fileid` = :dcValue2)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 UPDATE `oc_filecache` SET `mtime` = :dcValue4, `storage_mtime` = :dcValue5 WHERE (`fileid` = :dcValue1) AND (((`mtime` <> :dcValue2) OR (`mtime` IS NULL)) OR ((`storage_mtime` <> :dcValue3) OR (`storage_mtime` IS NULL)))
 primary  0 SELECT `path` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`fileid` = :dcValue2)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 UPDATE `oc_filecache` SET `mtime` = GREATEST(`mtime`, :dcValue1), `etag` = :dcValue3 WHERE (`storage` = :dcValue2) AND (`path_hash` IN ('d41d8cd98f00b204e9800998ecf8427e', '45b963397aa40d4a0063e0d85e4fe7a1'))
 primary  0 UPDATE `oc_filecache` SET `mtime` = GREATEST(`mtime`, :dcValue1), `etag` = :dcValue3 WHERE (`storage` = :dcValue2) AND (`path_hash` IN ('d41d8cd98f00b204e9800998ecf8427e', 'fb66dca5f27af6f15c1d1d81e6f8d28b', '3014a771cbe30761f2e9ff3272110dbf'))
 primary  0 INSERT INTO `oc_files_trash` (`id`, `timestamp`, `location`, `user`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4)
 primary  0 UPDATE `oc_file_locks` SET `lock` = :dcValue1 WHERE (`key` = :dcValue2) AND (`lock` = :dcValue3)
 primary  0 SELECT `id` FROM `oc_jobs` WHERE (`class` = :dcValue1) AND (`argument_hash` = :dcValue2) LIMIT 1
 primary  0 UPDATE `oc_jobs` SET `reserved_at` = '0', `last_checked` = :dcValue1, `last_run` = :dcValue2 WHERE (`class` = :dcValue3) AND (`argument_hash` = :dcValue4)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `fileid` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 UPDATE `oc_filecache` SET `mtime` = :dcValue4, `storage_mtime` = :dcValue5 WHERE (`fileid` = :dcValue1) AND (((`mtime` <> :dcValue2) OR (`mtime` IS NULL)) OR ((`storage_mtime` <> :dcValue3) OR (`storage_mtime` IS NULL)))
 primary  0 SELECT `path` FROM `oc_filecache` WHERE (`storage` = :dcValue1) AND (`fileid` = :dcValue2)
 primary  0 UPDATE `oc_filecache` SET `mtime` = GREATEST(`mtime`, :dcValue1), `etag` = :dcValue3 WHERE (`storage` = :dcValue2) AND (`path_hash` IN ('d41d8cd98f00b204e9800998ecf8427e', '45b963397aa40d4a0063e0d85e4fe7a1'))
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `size`, `unencrypted_size` FROM `oc_filecache` WHERE (`parent` = :dcValue1) AND (`size` >= :dcValue2)
 primary  0 UPDATE `oc_file_locks` SET `lock` = :dcValue1, `ttl` = :dcValue2 WHERE (`key` = :dcValue3) AND (`lock` = :dcValue4)
 primary  0 SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2)
 primary  0 SELECT `id`, `user_id`, `file_id`, `due_date`, `updated_at`, `created_at`, `notified` FROM `oc_files_reminders` WHERE `file_id` = :dcValue1 ORDER BY `due_date` ASC
 primary  0 DELETE FROM `oc_files_versions` WHERE `file_id` = :dcValue1
 primary  0 UPDATE `oc_file_locks` SET `lock` = `lock` - '1' WHERE (`key` IN (:chunk)) AND (`lock` > 0)

Our query log doesn't show data but the query SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`storage` = :dcValue1) AND (`path_hash` = :dcValue2) is run 20 (!) times.

Steps to reproduce
  1. Create test.txt
  2. Connect cadaver
  3. Enable query logging
  4. Run rm test.txt inside cadaver
Expected behavior

Reasonable number of queries.

Installation method

None

Nextcloud Server version

27

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named; start by reproducing deletion of a single file while capturing the SQL queries shown in the report. Trace which queries are triggered by the deletion and define done as reducing unnecessary database activity without changing deletion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.