nextcloud / nextcloud/activity

Missing index for queries run during upgrade

Open
#2,710 0 comments 0 reactions 1 assignee View on GitHub

@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

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.