Skip to content

perf: Delete previews in one go instead of individually #57593

Description

@artonge

With the new preview backend, we are deleting preview individually, this is probably expensive and slow.

public function deleteAll(): void {
$lastId = 0;
while (true) {
$previews = $this->previewMapper->getPreviews($lastId, 1000);
$i = 0;
// FIXME: Should we use transaction here? Du to the I/O created when
// deleting the previews from the storage, which might be on a network
// This might take a non trivial amount of time where the DB is locked.
foreach ($previews as $preview) {
$this->deletePreview($preview);
$i++;
$lastId = $preview->getId();
}
if ($i !== 1000) {
break;
}
}
}

Shouldn't we do it in one go?

  1. Flush the preview table
  2. Delete the preview directory

Previously it was done individually too.

Activity

  1. moved this from To triage to Triaged in 🧑‍🤝‍🧑 Community triageon Jan 16, 2026
  2. added this to the Nextcloud 33 milestone on Jan 16, 2026
  3. joshtrichards commented on Aug 5, 2026

    @joshtrichards
    Member

    Related: #48660

  4. added
    1. to developAccepted and waiting to be taken care of
    and removed
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions