Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cm-schl opened this issue Nov 27, 2024 · 0 comments

Comments

@cm-schl
Copy link

cm-schl commented Nov 27, 2024

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')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant