NextCloud is painfully slow and the desktop client disconnects before making it through a scanning operation

also check that redis is actually working (How to check if Redis is used in NC).
When I activated it everything sped up significantly. You could also try updating and make sure to check the recommendations in the settings.