In NC13, create an additional index in the sharing table for performance improvements (put your setup in maintenance mode before):
sudo -u www-data php occ db:add-missing-indice
There will be a mechanism to check this in future versions to notify users about it. It was not in the default update routine because it can take much time and should be executed in a terminal where no timeouts apply.
ref: https://docs.nextcloud.com/server/13/admin_manual/maintenance/upgrade.html#upgrading-to-nextcloud-13