镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Missing index for queries run during upgrade #2710

Open

Description

@mgallien

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions