Sync with NextCloud fast with mobile, extremely slow on Linux

This is not a WebDAV sync issue, but has everything to do with Nextcloud's flawed design.
Every single WebDAV request will trigger at least one database query, which will potentially go over millions of records.

I have experienced major performance issues when syncing with Nextcloud. This is just mind-boggling. I'm using Apache with event MPM, php-fpm (7.4) + OpCache, MySQL8 (via socket), Redis (via socket) (memcache.locking), APCu (memcache.local). The entire MySQL database fits into memory. All Nextcloud php files are compiled and cached in the OpCache.

For 910 items the sync with Nextcloud took about 1.5 hours. Running the same with a plain WebDAV implementation (without the Nextcluod BS), it took 17 minutes.