nextcloud / nextcloud/activity
Missing index for queries run during upgrade
Open
@miaulalala is already working on this.
Since Jun 25, 2026.
1. to develop
bug
Performance 🚀
- Dominant language
- JavaScript
- Stars
- 145
- Forks
- 72
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 42
Description
During upgrade, some SQL DELETE requests may be run on the activity table that would miss an index to be run quickly.
The request have a WHERE clause lie this one:
WHERE affecteduser <> ...
AND object_type = 'calendar'
AND object_id = ...
AND subjectparams LIKE '%...%'
Creating a new index like this
ALTER TABLE nextcloud_db.oc_activity
ADD INDEX activity_object_cleanup_idx (object_type, object_id),
ALGORITHM=INPLACE,
LOCK=NONE;
This changed the execution plan from a full table scan to an index query.
Doing that solved the slow upgrade process.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.