Optimize cleanup job by CarlSchwan · Pull Request #8421 · nextcloud/text

@CarlSchwan

Do that in one query instead of ending up doing N+1 queries.

Signed-off-by: Carl Schwan <carlschwan@kde.org>

@CarlSchwan

Decrease time to execute the query from 10s of seconds to a few
miliseconds.

Signed-off-by: Carl Schwan <carlschwan@kde.org>