Skip to content

Faster update by speeding up repair step "Remove activity entries of private events" #49520

@cm-schl

Description

@cm-schl

How to use GitHub

  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.
When running an update of our Nextcloud Instance (or occ maintenance:repair) I face a very intense slowdown (>30 min) on the repair step Remove activity entries of private events. oc_activity contains 312.577 entries and this does not seam to be very very much because I already searched a bit in the Nextcloud Forum.
It would be great if this step could be more fast.

Describe the solution you'd like
I tired to understand what happens on this step and it seams to me that

for every calendar entry of every user is trying to delete lines in oc_activity that in column affecteduser have something different than the user that is the owner of the calendar entry.
I asked myself if it wouldn't be possible to simply delete every entry of this type without having to do this in a while loop one by one? I may be wrong (very probably 😉) but couldn't we delete every entry in oc_activity that has an other value in affecteduser than in owner?

Say:

		$delete->delete('activity')
			->where($delete->expr()->neq('affecteduser', $delete->createParameter('owner')))
                        ->andWhere($delete->expr()->eq('owner', $delete->createParameter('owner')))
			->andWhere($delete->expr()->eq('object_type', $delete->createParameter('type')))
			->andWhere($delete->expr()->eq('object_id', $delete->createParameter('calendar_id')));

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions